user-pic

James

Subscribe to feed Recent Actions from James

  • Aristotle commented on TPF launches merch store for Perl 5
    The raptor is a Mojo creation.

    Incorrect. All three logos in fact go back to remarks by Larry, including the velociraptor.

    The earliest reference to the velociraptor by Larry that I can find is in Apocalpyse 12, where he only mentions it as a joke. Matt Trout later attributed to him a quote that “perl5 is a velociraptor. What we need now is an acceloraptor” (i.e. Perl 6 (at the time)) – though I am unable to substantiate this…

  • Aristotle commented on The Hidden Power of Prototypes

    That seems interesting in the sense of “may you live in interesting times” 😛

    Another possibly useful prototype is the underscore (“_”), which allows functions to default to $_ when given no argument, like e.g. chr and hex do.

  • RonW commented on The Hidden Power of Prototypes

    I agree that prototypes are a very useful tool. Try::ALRM is genuinely useful and interesting.

    I see the main limitation on prototypes being that & only coerces on the first parameter. I don't see a downside to & coercion on subsequent parameters. If the prototype says it should be a code ref, then if it looks like a block, treat it like a block, same as if the "sub" were there.

    I don't see much advantage to Dispatch::Fu. While it adds a little syntactic sugar, it's really just an indirect way to do:

    if ($cgi->param("action") eq q{foo} and $cgi->param("userid") !=…

  • Brett Estrade commented on The Hidden Power of Prototypes

    > I don't see much advantage to Dispatch::Fu. While it adds a little syntactic sugar, it's really just an indirect way to do...

    That's the point, but it's more than sugar! The computational complexity of determining the dispatch "key" is entirely contained in the "dispatch" block and is under the control of the developer. Once the "key" is determined, the proper method is called as O(1)!

    Thanks for all to good info above, didn't know bout the "_" allowing one to default to "$_" - I was actually wondering about that recently!

  • Brett Estrade commented on The Hidden Power of Prototypes

    I am not good at coming up with contrived examples as evidenced in this Perl Advent article,

    https://perladvent.org/2023/2023-12-13.html

    But a set of cascading "if" blocks is not the most exciting example. However, any code could go in there to compute the key to then "call".

Subscribe to feed Responses to Comments from James

About blogs.perl.org

blogs.perl.org is a common blogging platform for the Perl community. Written in Perl with a graphic design donated by Six Apart, Ltd.