user-pic

Damian Conway

Subscribe to feed Recent Actions from Damian Conway

  • Aristotle commented on Subroutine signatures in Perl are long overdue

    I honestly don't know why it's taken this long to even have them experimentally in the core.

    Yeah? Well I know. And Ross Attrill said it:

    Many of these modules seem to have many more features than the 5.19 proposal.

    That’s why. Everybody wants lots of features in signatures, and everybody wants a different set. So every previous proposal suffered the same fate: people couldn’t quite accept a signature proposal that lacked just the one extra feature that seemed indispensable given the over…

  • Aristotle commented on Subroutine signatures in Perl are long overdue

    (Oh and btw, in case my comment seemed berating – it wasn’t supposed to be, not exactly: I was myself one of the people who, in a previous round, thought a minimal signature proposal really can’t work without just that one extra feature. And that’s after I’d seen a previous proposal die from being loaded with obviously too many features in the first place. So the next time around I thought I was arguing for the minimum… which was nonsense. So by the time Peter Martini showed up with his patch, I had finally swallowed my lesson: any viable proposal must have…

  • martin.j.evans commented on Do not use each

    I only hit a problem with each recently (see http://www.martin-evans.me.uk/node/159). Using a hash in list context will use the iterator internally so simply assigning the hash you are iterating over to another hash will cause an infinite loop.

    I now never use each. Even if you find the narrow safe cases someone else can come along and easily break your code.

  • Timm Murray commented on Do not use each

    I've also seen situations where each was called in a loop that short-circuits:

    while( my ($key, $val) = each %hash ) {
        last if $key =~ /foo/;
    }
    

    Then later on, each is used again without resetting the internal state, even though the programmer expected to iterate over the entire hash. With a hash stored globally (yes, this is bad in itself, but it happens) in a persistent environment like mod_perl, this can even happen across different requests in the same process.

  • Tim Bunce commented on Do not use each

    I wonder if there's some way to make the each op warn if the iterator isn't where it's expected to be.

Subscribe to feed Responses to Comments from Damian Conway

About blogs.perl.org

blogs.perl.org is a common blogging platform for the Perl community. Written in Perl and offering the modern features you’ve come to expect in blog platforms, the site is run by Dave Cross and Aaron Crane, with a design donated by Six Apart, Ltd.