On Sat, Nov 06, 2004 at 10:37:39PM +0100, Juerd wrote: : Larry Wall skribis 2004-11-06 13:32 (-0800): : > On Sat, Nov 06, 2004 at 09:17:03PM +0100, Juerd wrote: : > : Which things can either have a name or be anonymous? : > (...) : > Lists (Lazy and Eager) : : If lists can be named, then is there still any difference between array : and list, except for automatic (de)referencing?
Lists can't in general be subscripted except by viewing them through the lens of an array. If you do manage to subscript a Lazy list, you'll find you have a list of generators, some of which are marked as logically flattened because they happened in a list context. But generally we try to hide all that mechanism behind a splat array. : > : And is there a way to name something that is anonymous? For example, : > : naming an anonymous subroutine can help when debugging. In Perl 5, : > : this is possible with Sub::Name. : > Easy, just one of : > my $named := anonymous(); : > my @named := anonymous(); : > my %named := anonymous(); : > my &named := anonymous(); : > my ::named := anonymous(); : : That's a lexical name. Are they used in error messages? (Can they be?) Generally not, unless we make aliasing smart enough to latch onto the first name and add it as a property to the anonymous object if it doesn't already have one. Larry