Damian Conway wrote:
> 
> And has anyone pointed out that C<list> is just:
> 
>         sub list {@_}

Hey, an easy IMPLEMENTATION section! I like it. ;-)

No, I hadn't gotten that far. But you're right (surprise :). The above
sub is an list constructor just like "() =" is. Awesome. I guess that
throws the "core bloat" counterargument right out.

One thing I would like to clarify is why there are only two real data
contexts, 'scalar' and 'list', and why 'wantarray' was all Perl had in
the past:

   $scalar  =  'x';                      # scalar context
   @array   =  (1, 2, 3, 4, 5);          # list context
   %hash    =  (key, val, key2, val2);   # list context

Granted, this is a grandiose oversimplification. But I want to nip the
"slippery slope" argument in the bud (i.e., "What next, boolean, hash,
etc, methods?"). I also want to dispell the misunderstanding that {} and
[] are used to construct hashes and arrays. They're not, they're used
for *anonymous* hashes and arrays, as seen in references:

   $array   =  [ 1, 2, 3, 4 ];           # array reference
   $hash    =  { key, val, key2, val2 }; # hash reference

These are completely different beasts altogether. They are not
analogous. Witness:

   $var     =  ( 1, 2, 3 );              # scalar context

-Nate

Reply via email to