On Thursday, January 30, 2003, at 12:49  PM, Austin Hastings wrote:
    undef @a[5];   # undefining the element sets it to the default
    @a[5];         # 2

    @a[5] = undef; # same as above
    @a[5];         # 2
undef!!

@a is an array of Int (not int) and can store undef, so no error occurs
when you make the assignment. But now I, the programmer, am saying that
of my own volition I want an undef in there, not a 2. If I wanted @a[5]
to take on the default value, I'd say so: C<@a[5] = @a.default;>
This is operating on Damian's premise that the presence of an undefined value is what causes the default value to be raised. So we don't have two types of undef (undef but undef, etc.)... a cell is either defined, or it's not. The presence of C<undef> is what triggers the default value, regardless of how the undef got there.

Thus, as Damian said, there is no way to place an undefined value in an array with a default:
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.
I'll document the behavior as Damian has specified it, since he's the ranking design team member here. If a design team member overrules, we'll change it to match.

MikeL

Reply via email to