develooper Front page | perl.perl6.language.subs | Postings from September 2000

Re: RFC 23 (v5) Higher order functions

Thread Previous | Thread Next
From:
Chaim Frenkel
Date:
September 23, 2000 20:18
Subject:
Re: RFC 23 (v5) Higher order functions
Message ID:
m3u2b6bhqd.fsf@csamnycln01.nyc.csam.com
>>>>> "DC" == Damian Conway <damian@cs.monash.edu.au> 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.
chaimf@pobox.com				               +1-718-236-0183

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About