Re: RFC 23 (v5) Higher order functions

[email protected] (Chaim Frenkel) 23 Sep 2000 23:18:18 -0400
Newsgroups perl.perl6.language.subs
Message-ID <[email protected]>
>>>>> "DC" == Damian Conway <[email protected]> writes:

>> Let me ask you:
>> 
>> foo('a','b', 'c')
>> 
>> Is 'b' the 1st parameter or the 2nd?

DC> This is the classical mistake of confusing indices and ordinals.
DC> The 1st argument is bound to the parameter whose index is [0],
DC> The 2nd argument is bound to the parameter whose index is [1], etc.

But why make it an index? It just reads better as an ordinal.

DC> Assuming they've read L<perlcurry>, they'll know that ^1 is $_[1] is
DC> parameter [1] is the 2nd parameter. They'll know because at the very start
DC> of L<perlcurry> I will write:

DC>         ^1 means $_[1], NOT $_[0]

[snip. Last message repeated too many times.]

If you have to do that, that is a good argument to follow the 'natural'
inclination.

Again, why insist on an index when it really is closer to an ordinal when
reading the actual code.

<chaim>
-- 
Chaim Frenkel					     Nonlinear Knowledge, Inc.
[email protected]				               +1-718-236-0183