--- Michael Lazzaro <[EMAIL PROTECTED]> wrote:
> 
> On Tuesday, January 28, 2003, at 01:01  PM, Nicholas Clark wrote:
> > On Tue, Jan 28, 2003 at 12:30:41PM -0800, Austin Hastings wrote:
> >> --- Michael Lazzaro <[EMAIL PROTECTED]> wrote:
> >>>      my int @a is Array( default => 5 );
> >>>      @a[0] = undef;
> >>
> >> This should cause a blip of some kind. If storing an explicit
> undef 
> >> (as
> >> opposed to "undef but 0" or C<$v = undef; @a[0] = $v;> there
> should be
> >> an exception. If storing an implicit undef: convert to int (IOW:
> 0) 
> >> and
> >> emit a warning.
> 
> Hmm.  I don't have a strong preference either way, but I'm not sure
> why 
> (given C<my int @a>):
> 
>     @a[ undef ]
> 
> C<undef> should be autoconverted to 0 with warning, but in:
> 
>     @a[0] = undef;
> 
> C<undef> should _not_ be autoconverted to 0, but instead trigger an 
> exception.
> 
> They're both in C<int> context, unless we want to make a special "int
> 
> being used as an array index" context that's different from normal 
> C<int> context.  Seems like C<undef> should be treated like 0 (plus 
> warning) in numeric context either everywhere, or nowhere. (?)

I agree. "Warning: Using undef as array index" would be a nice message
- probably save a bunch of debugging.

=Austin


Reply via email to