FAQ

RFC 23 (v5) Higher order functions

Chaim Frenkel
Sep 24, 2000 at 3:18 am

"DC" == Damian Conway 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
reply

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions