On Tuesday, January 28, 2003, at 01:14  PM, Damian Conway wrote:
I'm not compelled by the counter-argument that this makes it impossible to store an C<undef> in an array with a default. Because the whole point of an array having a default is to prevent those nasty out-of-range C<undef>s from popping up in the first place.

And thinking of defaults as mappings leads me to conclude that it's
entirely reasonable to allow sub refs as default specifiers, as a means of creating computed arrays. But I'd expect that the property name is different in that case (probably C<is computed>), so as to distinguish:
The next (oft-asked) question is whether or not C<is computed> denotes read-only, or if you can store to an C<is computed> array.

my @a is computed { $^index**2 };

@a[4] = 'something completely different';


And things like this would be downright hysterical:

my @a is computed { $^index**2 };

pop @a;

:-)

MikeL



Reply via email to