On 19 Sep 2000, Chaim Frenkel wrote:
> >>>>> "DC" == Damian Conway <[EMAIL PROTECTED]> writes:
>
> DC> But I'm *never* going to take out ^0. Having ^1 mean $_[0] is Just
> DC> Plain Wrong.
>
> Though I see your point. I'm not sure how many would make the connection
> between ^1 and $_[0].
>
> I see ^1 as the _first_ argument not as the zero-th offset. To my eyes
> a positional rather than an offset is more appropriate. It just reads
> better.
>
> Let me ask you:
>
> foo('a','b', 'c')
>
> Is 'b' the 1st parameter or the 2nd?
>
> sub { ^1 + ^2 }
>
> And when a newbie, not one of the oldtimers whose been part of perl6 since
> Damian's RFC came out. Would they think that the second and third arguments
> were added or the first and second?
>
Speaking as a newbie that has not been around since Damian's RCS came out
I conjure an image in my head that looks something like this:
^0 == $_[0] 0 == 0
^1 == $_[1] 1 == 1
^1 == $_[0] 1 == 0 ?
The first two notions make sense to me, the final one does not.
So sub { ^1 + ^2 } returns the sum of the second and third arguments.
Since when does 1 equal 0? What evil force has been unleashed on this world?
Unless you are confusing array indices with the ordinal regex match
variables. This is quite a leap. The currying positional placeholders
would indeed be similar in the sense that they are both a series of
variables that are automagically generated. Currently the regex match
placeholders are the only ones that vary in number and the positional
placeholders will join them and share this magical property.
For the sake of consistency should the positional placeholders begin at ^1? Of
course not. Consistency would be better served by having the curry
params mimic the array indices they symbolize. The
offset-into-an-array-ness of the positional placeholders has more to do
with the essence their being than their
context-dependent-count-of-variables-generated-ness.
As far a perlcurry goes it will be easier to convey the novice that:
Don't confuse the positional placeholders with regex match placeholders.
^1 is not $_[0].
Than it will be to convey that:
Just like the the regex match placeholders, positional placeholders begin
with ^1 so that ^1 == $_[0]. If this doesn't make sense to it is
probably because you are new to Perl and are not familiar with regular
expressions, but we did things this may to make it easier for
you to understand (assuming you read the regex chapter of the Camel
before the curry chapter.)
Alan Gutierrez