=head1 This Week on perl5-porters - 13-19 January 2008 "Shifting something that's not a number shouldn't produce a number." -- Abigail =head1 Topics of Interest =head2 C and smart match should warn in void context Larry Wall remarked last week that Zefram's suggestion regarding the propagation of context from Cs and Cs was how he deal with the matter. Nicholas spelled out his understanding of the matter. Zefram ventured further into the internals than he had ever been before and succeeded in returning with a patch to implement warnings in void context. Abigail thought that the exercise was a bit of a witch hunt but Larry was thought that it was unlikely that people had used the syntax intentionally, so the weight of backwards compatibility was not so great, in this particular case. http://xrl.us/betef =head2 C<+Inf>, C<-Inf> and C (and maybe -0.0 for good measure) In the thread about the latest C release, Jarkko Hietaniemi had noted that some platforms will dump core if you try to perform floating point arithmetic on a value set to infinity. Nicholas Clark wondered whether it was worth probing for the behaviour of these special quantities at configuration time, in order to Do The Right Thing on as many platforms as possible. Zefram suggested peeking at C, which can already isolate exotic floating point values in pure Perl. Craig Berry pointed out that it wasn't so much a problem of arithmetic I, since just about everything in use today implements IEEE 754 floats. It's not even a problem of exception handling, since that is governed by the IEEE standard as well. The tricky part is determining what exception handling is enabled by default on a given platform, and what can be turned on if you ask for it politely. His gave some pointers to additional resources on the web regarding the matter. there's a point to all this http://xrl.us/beteh =head2 Inconsistent bigint behaviour (with ranges) Moritz Lenz ran into difficulties using the range (C<$x .. $y>) operator appearing to use floating point numbers instead of integers (and hence, bigints). Tels was quick to point out that this was due to a long-standing bug in perl: one cannot overload the C<..> operator. The C package could do so if it were possible, but alas, the implementation is not there yet. want your 15 minutes of fame? http://xrl.us/betej Jerry D. Hedden wrote a patch to make the range operator behave in a slightly more sane manner, and this was applied by Rafael. http://xrl.us/betem =head2 Implementation of C in Perl 5.8.8 Dennis Williams wanted to implement C in Java and wondered how it was defined (having become lost after wading through some 18000 lines of the F shell script. Robin Barker told him how Configure chooses the best available implementation. Bennett told him how to find out what was chosen. http://xrl.us/beteo =head2 C EE 1 Abigail was rather surprised to discover that left- or right-shifting infinity returns merely a really huge number, rather than infinity. And shifting C produces zero. Zefram explained that infinity only really works when dealing with floating point numbers, and bit-shifting a floating point number would probably do no good to anyone. And the shift operators force integer context anyway. Tels was happy to report that C gets it right. Yitzchak Scott-Thoennes argued that it made sense to allow infinity to be shifted down among the integers. David Nicol did not agree with this and suggested that the way things were currently made some sort of sense. Zefram came back and said that it was probably too late to try and be more strict on the matter: no doubt there's someone out there who's relying on the property that 3 E<62>E<62> 1 == 1. Roland Giersig wondered what Inf E<62>E<62> Inf and Inf E<60>E<60> Inf should return, to which Zefram made a reasonable proposition. and I thought they said Perl was for text processing http://xrl.us/beteq Continuing in a numerical recipes vein, Nicholas reported that he had committed a change that will generate a warning if code tries to increment or decrement an integer beyond the last possible integer representation. at the end of the line http://xrl.us/betes Unfortunately, Andreas König was able to foil this plan with the careful application of the C<-O2> optimisation switch. This caused C to begin to fail. Nicholas Clark couldn't see a way to sneak a couple of instructions past the compiler to make it do the right thing. Jerry D. Hedden also found that it warned about things that we really don't care about. back to the drawing board http://xrl.us/beteu =head2 MIME types for module data Mark Overmeer wondered if there was some overall MIME type available for Perl that would allow module slinging around private data sets in a more orderly manner. Zefram gave an example of what an officially sanctioned IANA MIME type would look like. Mark wondered if you would have to pay a visit to IANA for each module. is this free as in beer? http://xrl.us/betew =head2 Onto perl 5.8.9 (Perl @ 32984) Nicholas Clark took a snapshot of the maintenance track to see how it would fare as a putative 5.8.9. He was hoping such a thing could be released before the German Perl Workshop, 5.10.1 or Christmas. Windows is behaving pretty well at the moment, thanks to Steve Hay's tireless smoking. Other platforms were doing less well: VMS was grumpy although Craig Berry and John E. Malmberg were on hand to smooth over the rough bits. David Cantrell noted severe breakage on a Cray, a Silicon Graphics IRIX box and NetBSD/Alpha as well. in need of TLC http://xrl.us/bete2 In fact, IRIX cannot compile 5.10.0, for that matter. http://xrl.us/bete4 Jerry D. Hedden also wondered about how the maint patch level should be defined in F. http://xrl.us/bete8 =head2 C for Perl programmers? Michael G. Schwern asked how a Perl programmer who knows no C might go about picking it up. A number of techniques were suggested, and books proposed. http://xrl.us/betfa =head1 What we all want [Note from the summariser: I have seriously overrun my time budget for this week. The following discussions are about major changes that people want to see in 5.12. The first items are continuations of threads from last week. The new threads have been summarised]. =over 4 =item am I a method call? http://xrl.us/betfc =item anonymous packages http://xrl.us/betfe =item named parameters http://xrl.us/betfg =item method declaration http://xrl.us/betfi =item saner behaviour for `length` http://xrl.us/betfk =item Direct BigInt (and BigRat) support http://xrl.us/betfn =back =head2 allowing trailing naked blocks in prototyped sub calls Aristotle Pagaltzis wanted C to do something nifty, given an appropriate C routine. Rafael nodded and said it would be nice to have. http://xrl.us/betfp =head2 named parameters + prototypes + methods + aliases The thread on naming subroutine parameters continued on this week with all sorts of syntax ideas and semantic considerations bandied about. Rafael brought it down to earth with the restating of the aliasing syntax that has been proposed in the TODO list for a long time. The best aspect of his proposal was that it was simple enough to stand a reasonable chance of being implemented. http://xrl.us/betfr =head2 Empty attributes As part of the named parameters thread, Peter Scott wondered why C compiled and ran normally. It turns out that it's being parsed as an empty attribute list. So it's allowed, but it does absolutely nothing. Peter wondered why it was so. No-one was able to give an explanation. Rafael thought it was a parser bug until Peter pointed to the tests that pin down the behaviour. time for an archeological expedition http://xrl.us/betft =head2 Recurse into current C Moritz Lenz has started to play with the new C<(?R)> recursive sub pattern and was saddened to discover that it couldn't recurse across a C boundary. Yves Orton didn't dismiss the idea out of hand, but said that it didn't weigh much against his current list of priorities. The best chance of it happening would depend on what Dave Mitchell and he planned to do to the regexp engine in the future. maybe we'll get it for free http://xrl.us/betfv =head2 Tail calls for methods Yuval Kogman noted that it was difficult to do tail recursion cleanly in Perl, and suggested that with a dash of C syntactic sugar, it would allow the compilation phase to do the right thing. Part of the problem concerns what to do with C, which was covered in a thread a few weeks ago. Jim Cromie restated his op mashup idea, of combining adjacent C/C ops. Nicholas Clark thought that it could be prototyped using an external XS module. http://xrl.us/betfx =head2 A working SUPER Johann Vromans lamented that C referred to the superclass(es) of the package, and not that or those of the object. Stevan Little thought that the new MRO infrastructure in 5.10 may be of some help. Some people mentioned C as coming close, but a common theme was that it was too slow. At the end of the week, no real concensus had been reached. that's really super, super-girl http://xrl.us/betfz =head2 Clean up dereferencing syntax for slices Curtis "Ovid" Poe proposed a simplification for slicing arrays and hashes. Everyone agrees the current syntax, especially when references come into the picture, is pretty horrendous. Ricardo Signes found the fatal flaw, and so Ovid suggested a more alien syntax with a sigil after the arrow, which made Ricardo wonder if it couldn't be done with an autoboxed method, at the expense of a bit of verbiage. Zefram found the fatal flaw in that idea: if the thing being sliced is a blessed reference then the method resolution may call something else. back to the drawing board http://xrl.us/betf3 =head1 Patches of Interest =head2 Double free error in 5.10.0 Gerard Goossen proposed a patch to fix the C / C problem. Unapplied. http://xrl.us/betf5 Nicholas wondered if there was another way to achieve the goal. http://xrl.us/betf7 =head2 2..Inf and beyond The thread continued this week, with the more pragmatic porters pointing out that one should really use a C loop and increment a counter variable each time through the loop. Michael G. Schwern said that was okay if you were used to procedural languages, but if all you had ever known were Perl ranges it would be nice if they did the right thing. At the end of thread, people started to coalesce upon the idea of an new internal type that would provide a direct connection to a bigintish datatype, be it a fast C library like GMP or a slower pure-Perl implementation. http://xrl.us/betf9 =head2 F: C's parameter list mangled Steven Schubiger supplied a small apidoc patch, which was applied. http://xrl.us/betgb =head1 New and old bugs from RT =head2 Outdated C (#49504) Imacat offered to take over the maintenance of C (insofar as this involves watching over a dying patient and waiting until it is safe to pull the plug on the life support systems, and made an impassioned plea defending her approach to smoke testing CPAN modules. Apart from that, the thread devolved into your standard argument regarding C I C. Everyone remained very polite, more credit to the porters, but the reader must forgive the summariser for not going into more detail than saying that the versions of the CPAN shell bundled with older releases of Perl are the root of many problems @@@FIXME@@@ One new item to come out the discussion, however, was Michael G. Schwern's observation that C's auto-generated F was pretty hopeless, yet it would be a Simple Matter Of Programming to make it do a better job. hey! Module::Build is bundled with 5.10 http://xrl.us/betgd do your part for useful READMEs http://rt.cpan.org//Ticket/Display.html?id=32391 =head2 C now works (#49646) Rafael Garcia-Suarez and Mashrab Kuvatov sorted out what the problem was and fixed it up, and the thread painted the bikeshed green. http://xrl.us/betgf =head2 glibc error using C on 5.10 (#49724) Testcase needs to be slimmed down before anything can be done to diagnose the problem. come and look on my screen http://xrl.us/betgh =head2 Regular expression delimiter sensitivity (#49800) Someone reported a regular expression changing behaviour when run outside or inside the debugger. is ? a wise choice for a regexp delimiter? http://xrl.us/betgj =head2 Encode C does not return on invalid conversion (#49830) Someone spotted some new behaviour in the version of C bundled with 5.10. Paging Dan Kogai. http://xrl.us/betgm =head2 XS OVERLOAD keyword causes incorrect C code generation (#49844) Salva Fandiño reported a problem using the C clause in an XS file. Torsten Schönfeld reported that an equivalent bug report was filed against the C queue, but had received no replies. http://xrl.us/betgo =head2 Bad rounding on C (#49872) Roland Giersig ran into problems with integer truncation of calculations involving logarithms, and was surprised by some of the results. People explained that it was due to floating point imprecision (as usual). fuzzing around http://xrl.us/betgq =head2 C/C do not use C (#49914) Well they sort of do, but Abe Timmerman discovered that if you override C