Juerd <[EMAIL PROTECTED]> writes:

> Michele Dondi skribis 2005-11-04 14:58 (+0100):
>> Let me explain: we all know that Perl5 has a very simple parameter
>> passing mechanism for subs and an even more rudimentary
>> {prototyping,signature} mechanism that one actually seldom uses.
>
> It is unused because it sucks. </blunt>
>
>> With this simple mechanism one can implement or fake quite a lot of
>> parameter passing paradigms.
>
> And it is a lot of work to do so.
>
>> for simple subs in Perl6 I will probably still use @_
>
> You'd be a fool to do so, with the sole exception of list manipulation,
> which at least in my codebase isn't used quite that much, and almost
> never listens to the qualification "simple sub".
>
> Compare:
>
>     sub dosomething { @_[0] blah @_[1] }
>
>     sub dosomething ($a, $b) { $a blah $b }
>
>     sub dosomething { $^a blah $^b }
>
> The @_ solution is really the most ugly and hard to type of the three
> possibilities.
>
>> err... that or the new pointy subs which are indeed so cool!
>
> Cool, but probably not a good idea for named subs, if only for style.
>
>     our &dosomething ::= -> $a, $b { $a blah $b }
>
> Not really a winner in any perspective.

And the return semantics of pointy blocks are different, you have to be careful
about doing an explicit return in them because that returns to the caller of
the lexical scope in which they were defined (otherwise for ... -> ... {...}
wouldn't work)

-- 
Piers Cawley <[EMAIL PROTECTED]>
http://www.bofh.org.uk/

Reply via email to