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

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



Thus it was written in the epistle of Bart Schuller,
> On Thu, Jan 13, 2000 at 01:08:52PM -0700, Tom Christiansen wrote:
> > This is nice and parallel.  splice() to an array is delete() to a
> > hash.  Well, I sure thought it was.  Isn't it?  I don't really
> > understand how to modify this for the proposed behaviour of delete
> > $array[1].  Please help me out here.
> 
> Stop!
> 
> You can't be serious, splice changes half of your keys. There's no
> equivalent with hashes.

But he is serious.  And ought to be.  Undefined is a state of being.  That it 
is implemented by a specific value is of significance to those who have their
hands in the guts of perl and to this point has been of much less significance
to the average perl programmer.  That is, to say "I defined that to be
undefined" is a very strange twist.  This "uninitialized"--as distinct from 
"undefined" is rather unsettling.  

What Tom's talking about is that delete gets rid of a key-value pair in a 
hash.  Eliminates it.  Deletes it if you will.  Takes one of the pieces of the
hash and stops it's existence.  The logical thing for delete to do on arrays 
is, by my call, to do the same thing for arrays.  Well, then, what happens 
when a piece of an array goes away?  Is there a hole left?  No.  An array is a
solid chunk of space.   Any "holes" are undefined.  There isn't another option.
Either they have something or they don't and "don't" is undef.  I say make
delete on an array element do the same thing as splicing it out (there's a 
strange phrase :-).  

Oh, and let's sit on pseudo-hashes until there's been some more discussion of
them.  So, I guess I vote 2.  Or 4. if the above definition of delete on array
elements strikes everyone's fancy.

Ted
-- 
Ted Ashton (ashted@southern.edu), Info Serv, Southern Adventist University
          ==========================================================           
The concept of number is the obvious distinction between the beast and man.
Thanks to number, the cry becomes a song, noise acquires rhythm, the spring
is transformed into a dance, force becomes dynamic, and outlines figures.
                        -- Maistre Joseph Marie de (1753 - 1821)


Follow-Ups from:
"Mark Mielke" <markm@nortelnetworks.com>
Gurusamy Sarathy <gsar@ActiveState.com>
References to:
Tom Christiansen <tchrist@chthon.perl.com>
Bart Schuller <schuller@lunatech.com>

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