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

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



On Thu, 13 Jan 2000 10:00:29 MST, Tom Christiansen wrote:
>>The semantics are such that there can never be any uninitialized elements
>>at the end of the array.
>
>Could you please define "uninitialized"?

I think the best I can do is "never assigned a value".  Internally, it is
defined as == &PL_sv_undef, but that's just an implementation detail.

>                                          Could you please distinguish
>this from "undefined"?

You can assign an undefined _value_ to something.  But there's no concept
of assigning an uninitialized _value_, because it is an attribute (or
state of being).

IOW, "uninitialized" is a stronger particular condition than "undefined".

>                        Can only the scalar elements in an array
>be uninitialized?

What other elements of an array are there.

>                   Is this all arrays, or only pseudo-hashes?

All arrays and all pseudo-hashes.

>                                                               What
>about the scalar elements in a hash?

The change does not affect hashes.

>                                      Can they also be uninitialized?

Yes, using delete() as we've always been able.

>How does this different from a nonexistent value (undef $h{K}) or
>a nonexistent key (delete $h{K})?

It is the same as the difference between:
    $h{K} = undef;  or undef $h{K};
                vs.
            delete $h{K}

>                                  Can we now delete any scalar,
>or only elements of aggregates;

delete() only works on elements of arrays, pseudo-hashes, and hashes.
I don't know what it should mean on "any scalar".

>                                and what about functions?

I don't think I understand the question.  Please rephrase.

>                                                           Can we
>now say exists on any scalar, or only on elements of aggregates;

exists() only works on elements of arrays, pseudo-hashes, and hashes.

>and again, what about functions?

I don't think I understand the question.  Please rephrase.

>The nature of truth is becoming very blurred in my own mind, at least.

I think I agree, but the notion of "whether an element truly exists" is
not new.  We've had it all along for hash elements.


Sarathy
gsar@ActiveState.com


References to:
Tom Christiansen <tchrist@chthon.perl.com>

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