On 5/11/05, Juerd <[EMAIL PROTECTED]> wrote:
> Jonathan Scott Duff skribis 2005-05-11 11:45 (-0500):
> > 1. specialise ()[] to parse as (,)[]
> > 2. scalars are singleton lists, so ()[] naturally
> > 3. make (1)[0] die horribly.
> > #2 implies that (1)[0][0][0][0] == 1
> > #1 means that (1)[0] == 1 and (1)[0][0] is an error
> 
> #1 also means that ($aref)[0] is $aref, rather than $aref[0].
> 
> I pick #2, also because I think being able to pass scalars where arrays
> are expected simplifies other parts of the language as well.

#2 is also more intuitive and comfortable. () in P5 constructs a list,
which is why (split ' ', $foo)[0] works so nicely.

Reply via email to