This Week on perl5-porters - 13-19 January 2008

This Week on perl5-porters - 13-19 January 2008

"Shifting something that's not a number shouldn't produce a number." -- Abigail

Topics of Interest

grep and smart match should warn in void context

Larry Wall remarked last week that Zefram's suggestion regarding the propagation of context from greps and maps 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.

+Inf, -Inf and NaN (and maybe -0.0 for good measure)

In the thread about the latest Math::Complex 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 Data::Float, 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 per se, 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

Inconsistent bigint behaviour (with ranges)

Moritz Lenz ran into difficulties using the range ($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 .. operator. The bigint package could do so if it were possible, but alas, the implementation is not there yet.

  want your 15 minutes of fame?

Jerry D. Hedden wrote a patch to make the range operator behave in a slightly more sane manner, and this was applied by Rafael.

Implementation of rand() in Perl 5.8.8

Dennis Williams wanted to implement rand in Java and wondered how it was defined (having become lost after wading through some 18000 lines of the Configure shell script.

Robin Barker told him how Configure chooses the best available implementation. Bennett told him how to find out what was chosen.

Inf >> 1

Abigail was rather surprised to discover that left- or right-shifting infinity returns merely a really huge number, rather than infinity. And shifting NaN 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 bigint 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 >> 1 == 1. Roland Giersig wondered what Inf >> Inf and Inf << Inf should return, to which Zefram made a reasonable proposition.

  and I thought they said Perl was for text processing

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

Unfortunately, Andreas König was able to foil this plan with the careful application of the -O2 optimisation switch. This caused t/op/inc.t 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

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?

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

In fact, IRIX cannot compile 5.10.0, for that matter.

Jerry D. Hedden also wondered about how the maint patch level should be defined in patchlevel.h.

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.

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].

am I a method call?
anonymous packages
named parameters
method declaration
saner behaviour for `length`
Direct BigInt (and BigRat) support

allowing trailing naked blocks in prototyped sub calls

Aristotle Pagaltzis wanted foo 1, 2, 3, 4 { say @_ } to do something nifty, given an appropriate foo routine. Rafael nodded and said it would be nice to have.

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.

Empty attributes

As part of the named parameters thread, Peter Scott wondered why my $x := 24 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

Recurse into current qr//

Moritz Lenz has started to play with the new (?R) recursive sub pattern and was saddened to discover that it couldn't recurse across a qr 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

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 tailcall syntactic sugar, it would allow the compilation phase to do the right thing. Part of the problem concerns what to do with caller, which was covered in a thread a few weeks ago.

Jim Cromie restated his op mashup idea, of combining adjacent leavesub/entersub ops. Nicholas Clark thought that it could be prototyped using an external XS module.

A working SUPER

Johann Vromans lamented that SUPER 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 NEXT 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

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

Patches of Interest

Double free error in 5.10.0

Gerard Goossen proposed a patch to fix the s///ge / FREETMPS problem. Unapplied.

Nicholas wondered if there was another way to achieve the goal.

2..Inf and beyond

The thread continued this week, with the more pragmatic porters pointing out that one should really use a while(1) 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.

perlintern.pod: PAD_CLONE_VARS's parameter list mangled

Steven Schubiger supplied a small apidoc patch, which was applied.

New and old bugs from RT

Outdated Test::Harness::Straps (#49504)

Imacat offered to take over the maintenance of Test::Harness::Straps (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 Module::Build versus ExtUtils::MakeMaker. 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 Module::Build's auto-generated README 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

  do your part for useful READMEs

open ':locale' 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.

glibc error using Tie::File 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

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?

Encode from_to() does not return on invalid conversion (#49830)

Someone spotted some new behaviour in the version of Encode bundled with 5.10. Paging Dan Kogai.

XS OVERLOAD keyword causes incorrect C code generation (#49844)

Salva Fandiño reported a problem using the OVERLOAD clause in an XS file. Torsten Schönfeld reported that an equivalent bug report was filed against the ExtUtils::ParseXS queue, but had received no replies.

Bad rounding on int(log()) (#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

gmtime()/localtime() do not use time() (#49914)

Well they sort of do, but Abe Timmerman discovered that if you override time, the gmtime and localtime routines will happily ignore the override, and continue to use the underlying code that returns the epoch.

  time time time, see what's become of me

Ambigous Configure run/make error (#49946)

Stefan Schlotterbeck-Macht was seriously Warnocked after getting stuck trying to cross-compile Perl onto avr32-linux platform.

  hints wanted

Perl 5.10 @ISA bug (#49952)

Andrei Galea uncovered some @ISA behaviour modification in 5.10 when using Tk.

  hairy inheritance

perl fails to compile in B::C (#49974)

A cautionary tail: if you rsync the latest source, you must ensure that you do so with the --delete switch. Sometimes dead wood makes a log jam.

  we gave it the axe

Perl5 Bug Summary

  14 new + 1474 open = 1788 (created 8, closed 0)

This is the BBC

Getopt::Euclid 0.1.0

The current state of blead made one Getopt module fail, this one by Damain Conway.

  that's ok, there are plenty of others

In Brief

Robin Barker had some consting goodness applied to regexp.h

H.Merijn Brand tried building perl on Cygwin and ran into trouble. Reini Urban stepped up to help him out, offering a few suggestions every Cygwin blead smoker needs to know.

Jerry D. Hedden had a pile of taint test fixes for Cygwin, and this made all the tests pass. This made Nicholas Clark happy.

David Landgren wondered whether is behaved correctly for tied objects when one needs to write ok($x == 1) instead of cmp_ok($x, '==', 1) but received no reply.

  fringe benefits

Jan Dubois noted that File::GlobMapper, part of the IO::Compress infrastructure, should not be marked as an alpha release (since it's now in 5.10). Paul Marquess agreed, and promised to push out a new version, sans the message of doom.

  good thing it's dual-lifed

Sébastien Aperghis-Tramoni found a small bug in microperl regarding uconfig.h; Steve Peters regenerated it into a healthy state.

Steven Schubiger thought that the documentation for sv_cmp_locale should not say "see also sv_cmp_locale". Not applied.

  recursion: see recursion

Salvador Fandiño wondered if the new hints infrastructure could help solve the bug regarding overloading constants not propagating into string evals.

  gotta perlbug id?

Jan Dubois reported that Compress::Zlib 1.42 was failing tests on both blead and maint, and pointed to an older thread on the matter. Nicholas Clark backed the change out of maint.

Text::Balance received a better version number in maint.

Nicholas also suggested that distinguishing between use warnings and use warnings 'all' would allow the porters to ease the restrictions in adding new warnings to maintenance releases.

  it never used to do that!

Johan Vromans complained about smoke runs complaining about inconsistent test results between TEST and harness. Some tests are known to be very sensitive to timing issues and system load. So the tests should either go, or be marked as informational (and thus insufficient grounds for aborting a launch).

  all systems go

While hacking on kurila, Gerard Goossen spotted what he thought may be a latent bug in the routine do_openn in doio.c, and thought someone more intimate with the code should see if it was a problem.

He also proposed a patch, not applied, that would cause -DT to report forced tokens (during tokenisation).

  what you always wanted to know

Andrea König produced a patch for YAML::Syck to make it aware of the 5.11 native REGEXP type. Audrey Tang took the patch and pushed version 1.01 out the door. Michael G. Schwern thought the patch was a bit clunky, but Nicholas pointed out that the way it was written prevents dead code from forming in 5.10 and below.

Jerry D. Hedden uncovered a problem with a target needed for suidperl. Even though the resulting binary is vaguely deprecated, Nicholas Clark managed to get thing running smoothly again.

  until the next time it breaks

Jerry noted that the change didn't make it past the door.

David Cantrell wanted to be able to lchown in perl 5.12, so Yitzchak wrote a patch to do it for him.

Nicholas Clark had a bit of trouble fiddling with version numbers in Test::Harness, as there are now three active branches in the repository.

  head, explodes

Johnathon Rockway related a question from the perl-qa mailing list, as it relates to is_deeply and qr// on 5.11

Nicholas saw how itersave in used struct block_loop, but wondered why, and whether it was ever, or still, necessary.

About this summary

This summary was written by David Landgren.

  last week's, reduced to clear

Weekly summaries are published on and posted on a mailing list, (subscription: The archive is at Corrections and comments are welcome.

If you found this summary useful, please consider contributing to the Perl Foundation to help support the development of Perl.