Stéphane Payrard wrote: > On (14/11/02 16:21), Garrett Goebel wrote: > > Stéphane Payrard wrote: > > > > > > But when we say literal array, do we talk about the representation > > > or the value? > > > > The representation of a fixed value. > > > > If a literal is the representation of a constant value, > > then a literal array is yet another representation of a > > constant value. For example, the C string literal 'ABCD' > > is a literal array of bytes equivalent to the little- > > endian integer literal 0x44434241. I've seen a lanugage > > with a literal array notation like #[65,66,67,68] that > > would be equivalent... but I'm not aware of any C syntax > > to do something similar. > > > > However, I should add that it seems as often as not that > > when other people talk of literal arrays, they talk about > > arrays of literals, and not arrays representing fixed > > values. > > Even more so in perl5; we indeed speak of list instead of > literal array because besides of the constness they behave > differently. In scalar context a list returns its last > element, but an array returns its size. Is that "fixed" in > Perl6?
Yes it has been fixed. Apocalypse 2, RFC 175: > In Perl 6, a list used in a scalar context will automatically > turn itself into a reference to the list rather than returning > the last element I'm not sure I would agree that Perl6 lists are literal arrays. Why? Because the details in Apocalypse 2, RFC 175 are ambiguous. What happens in Perl6 when you do this: my $list = [1,2,3]; $list[0]++; Larry wrote: > > [1,2,3]; > > is syntactic sugar for something like: > > scalar(list(1,2,3)); So back to my example. Is it an error? If lists are literal arrays than the elements are literal values. If not an error, then what is the list/array distinction? If lists have constant-ness, then there are optimizations to be had... Or as Larry wrote: > > Depending on whether we continue to make a big deal of > the list/array distinction, that might actually be spelled: > > scalar(array(1,2,3)); -- Garrett Goebel IS Development Specialist ScriptPro Direct: 913.403.5261 5828 Reeds Road Main: 913.384.1008 Mission, KS 66202 Fax: 913.384.2180 www.scriptpro.com [EMAIL PROTECTED]