[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]

Re: exists $foo[7] and delete $foo[7]



G'day all.

Tom Christiansen writes:
: Of course I'm serious.  Remember, indices aren't keys.  They're just
: positions.  splice completely removes an entry from an array in a way 
: that undef will not, just as delete completely removes an entry from a
: hash the way that undef will not.

Larry Wall <larry@wall.org> wrote:
> I think they're keys.  They're just constrained to be numeric as
> a very valuable hint for optimization.

I think they are formal parameters to a class of dynamically modifiable
finite functions, defined on integers.  If you take that view, C<undef>
has a nice theoretical meaning: the function is not defined on that
element of its domain.

What worries me about the proposed change is that C<undef> is slowly but
surely turning into C<NULL>; it's becoming a sentinel value rather than
"undefined".  That mildly annoys me.

> And in the case of built-in
> arrays, determining order.

BTW, Tom's proposal for C<delete $array[4]> does preserve order. :-)

Cheers,
Andrew Bromage


[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]