> From: Deborah Ariel Pickett <[EMAIL PROTECTED]>
> Date: Tue, 11 Feb 2003 11:15:13 +1100 (EST)
>
> In Perl6, where there seems to be even more of a blur between
> compile-time and runtime, I don't think it's always going to be possible
> (i.e., easy) to know where naming an array or providing an actual list
> would produce the same effect. The switch statement was my example.
> Apocalypse 4 has a table (page 2 of the perl.com version) which bears
> this out. Lists have their own entries on this table, separate from
> arrays. So it's conceivable that a switch statement that switches on a
> list and a switch statement that switches on an array containing the
> same list produces different results.
In these terms, I'd like to refer you to Apocalypse 2, under RFC 009.
I belive this is one (perhaps the only :) thing that hasn't changed
about Perl 6 sice A2. Particularly:
... If composite variables are thought of as scalar references,
then the names @foo and %foo are really scalar variables unless
explicitly dereferenced. That means that when you mention them in
a scalar context, you get the equivalent of Perl 5's \@foo and
\%foo. This simplifies the prototyping system greatly, in that an
operator like push no longer needs to specify some kind of special
reference context for its first argument -- it can merely specify
a scalar context, and that's good enough to assume the reference
generation on its first argument....
Indeed, this supports the distinction, which I will reiterate:
- Arrays are variables.
- Lists are values.
Arrays are things that know about lists. They know how to get a
particular element out of a list. They know how to *flatten
themselves, interpolating themselves into the surrounding list. They
know how to map, grep, sort, splice themselves. They know how to turn
themselves into a scalar. Lists don't know how to do these things.
Just like, for example, scalars. A scalar can hold a number. A
scalar knows how to increment itself, but a number sure doesn't.
I'm formulating new, wild ideas here... Another post coming in a
minute. I hope I clarified the array/list thing at least a little
bit.
Luke