in reply to how does splice do it?

The answer to this question is now clear, however I am worried to hear that some monks were thinking this is stylish, and want to follow it in the future.

I would say NO to this style:
  1. First, put it plain, you didn't gain anything by doing this. Performance would be the same, if it is not worse. Some people may think it looks nice, okay, maybe, but you lose the correctness of your code. (I am not saying the way this syntax being used is wrong, but more saying it is wrong for Perl to support this kind of hacking.)
  2. Perl does have a problem with HACKING, and this is just one example. The hacking approach makes Perl more modern without costs too much effort, but remember that those are not part of Perl's foundation.

    For this particular question we are facing now, let me borrow this slogan from GUI design, WHAT YOU SEE IS WHAT YOU GET. The syntax of a programming language should follow the same rule, and one syntax-look-alike should not have two meanings.

    Prototype is supposed to be a guardian, who stops parameter type errors, but now this good will is VIOLATED AND BROKEN. The extra effort of implicit conversion is a little interesting trick, but that's it.

    I am a big fan of Perl, but definitely not a big fan of those hackings.

To be frank, I would expect this to be one of the first things they want to CORRECT in Perl 6.

Replies are listed 'Best First'.
Re: Re: how does splice do it?
by BrentDax (Hermit) on Jan 10, 2003 at 20:21 UTC
    I'm not sure if they'll "correct" it , by your definition of "correct". Perl 6 will support full, C-style prototypes, with types and names declared in the subroutine declaration. (It'll still use @_ if you don't declare a prototype.) But by default, arrays won't flatten if there's a prototype on the subroutine; you'll have to use the unary * (flattening) operator either in the declaration or in the call.

    I have a Perl6::Parameters module on the CPAN that implements a (pathetically small and out-of-date) subset of the Perl 6 behaviors.

    =cut
    --Brent Dax
    There is no sig.