From: Pascal B. <pa...@dy...> - 2000-12-13 19:09:18
|
Why do we still use deleteFromArray ? can't we just use the delete array[element] syntax as used a few releases ago by Scott? wouldn't delete .. be faster then cycling thru all array elements? Pascal Bestebroer pa...@dy... http://www.dynamic-core.net |
From: Scott A. L. <sc...@sc...> - 2000-12-13 19:58:38
|
> Why do we still use deleteFromArray ? deleteFromArray is still useful for removing items from ordinal (non-associative) arrays while maintaining the correct array length. -- scott andrew lepera ----------------------------------- web stuff: www.scottandrew.com music stuff: www.walkingbirds.com |
From: Brandon M. <bnd...@ho...> - 2000-12-14 15:58:39
|
It's not the array length that's important.. it's maintaining proper order.. It wouldn't be "prudent" if we just removed item 4 from an array of 10. there would be a gaping hole. (For all you people outside america... prudent: A little President Bush humor. ) > -----Original Message----- > From: dyn...@li... > [mailto:dyn...@li...]On Behalf Of Scott Andrew > LePera > Sent: Wednesday, December 13, 2000 2:59 PM > To: dyn...@li... > Subject: Re: [Dynapi-Dev] deleteFromArray > > > > Why do we still use deleteFromArray ? > > deleteFromArray is still useful for removing items from ordinal > (non-associative) arrays while maintaining the correct array length. > > > -- > scott andrew lepera > ----------------------------------- > web stuff: www.scottandrew.com > music stuff: www.walkingbirds.com > _______________________________________________ > Dynapi-Dev mailing list > Dyn...@li... > http://lists.sourceforge.net/mailman/listinfo/dynapi-dev |
From: Pascal B. <pa...@dy...> - 2000-12-14 18:27:59
|
hmm, so a delete array[element] will leave a gap instead of removing the element and move all "higher" elements down one step ? Pascal Bestebroer pa...@dy... http://www.dynamic-core.net > -----Oorspronkelijk bericht----- > Van: dyn...@li... > [mailto:dyn...@li...]Namens Brandon Myers > Verzonden: donderdag 14 december 2000 17:01 > Aan: dyn...@li... > Onderwerp: RE: [Dynapi-Dev] deleteFromArray > > > It's not the array length that's important.. it's maintaining > proper order.. > > It wouldn't be "prudent" if we just removed item 4 from an array of 10. > there would be a gaping hole. > > (For all you people outside america... > prudent: A little President Bush humor. > ) > > -----Original Message----- > > From: dyn...@li... > > [mailto:dyn...@li...]On Behalf Of Scott Andrew > > LePera > > Sent: Wednesday, December 13, 2000 2:59 PM > > To: dyn...@li... > > Subject: Re: [Dynapi-Dev] deleteFromArray > > > > > > > Why do we still use deleteFromArray ? > > > > deleteFromArray is still useful for removing items from ordinal > > (non-associative) arrays while maintaining the correct array length. > > > > > > -- > > scott andrew lepera > > ----------------------------------- > > web stuff: www.scottandrew.com > > music stuff: www.walkingbirds.com > > _______________________________________________ > > Dynapi-Dev mailing list > > Dyn...@li... > > http://lists.sourceforge.net/mailman/listinfo/dynapi-dev > > _______________________________________________ > Dynapi-Dev mailing list > Dyn...@li... > http://lists.sourceforge.net/mailman/listinfo/dynapi-dev > |
From: Jared N. <ja...@aa...> - 2000-12-14 18:45:14
|
<script> t=new Array(1,2,10,22,55) delete t[1] alert(t.length) //still 5 alert(t[1]) // undefined </script> yeah thats the problem with just using delete |
From: Scott A. L. <sc...@sc...> - 2000-12-14 19:14:39
|
> hmm, so a delete array[element] will leave a gap instead of removing the > element and move all "higher" elements down one step ? Yes, Brandon is correct in this. That's one of the reasons why removeFromArray was created in the first place. It keeps ordinal arrays in the correct order when you remove an element. -- scott andrew lepera ----------------------------------- web stuff: www.scottandrew.com music stuff: www.walkingbirds.com |
From: Brandon M. <bnd...@ho...> - 2000-12-14 22:17:52
|
I, in practice, when needing a name/value pair array... use objects. It's not good practice to use a for-in on an ordinal array.. and very poor practice to mix ordinal and associative arrays.. even though the language supports it. Just because a language supports something doesn't mean that it's a good thing to use. > -----Original Message----- > From: dyn...@li... > [mailto:dyn...@li...]On Behalf Of Scott Andrew > LePera > Sent: Thursday, December 14, 2000 2:15 PM > To: dyn...@li... > Subject: Re: [Dynapi-Dev] deleteFromArray > > > > hmm, so a delete array[element] will leave a gap instead of > removing the > > element and move all "higher" elements down one step ? > > Yes, Brandon is correct in this. That's one of the reasons why > removeFromArray was created in the first place. It keeps ordinal arrays > in the correct order when you remove an element. > > -- > scott andrew lepera > ----------------------------------- > web stuff: www.scottandrew.com > music stuff: www.walkingbirds.com > _______________________________________________ > Dynapi-Dev mailing list > Dyn...@li... > http://lists.sourceforge.net/mailman/listinfo/dynapi-dev |
From: Doug M. <do...@cr...> - 2000-12-14 22:41:01
|
Visual Basic is one big example of "Just because a language supports something doesn't mean that it's a good thing to use.".. hehe Doug Melvin ----- Original Message ----- From: "Brandon Myers" <bnd...@ho...> To: <dyn...@li...> Sent: Thursday, December 14, 2000 2:20 PM Subject: RE: [Dynapi-Dev] deleteFromArray > I, in practice, when needing a name/value pair array... use objects. > It's not good practice to use a for-in on an ordinal array.. and very poor > practice to mix ordinal and associative arrays.. even though the language > supports it. Just because a language supports something doesn't mean that > it's a good thing to use. > > > -----Original Message----- > > From: dyn...@li... > > [mailto:dyn...@li...]On Behalf Of Scott Andrew > > LePera > > Sent: Thursday, December 14, 2000 2:15 PM > > To: dyn...@li... > > Subject: Re: [Dynapi-Dev] deleteFromArray > > > > > > > hmm, so a delete array[element] will leave a gap instead of > > removing the > > > element and move all "higher" elements down one step ? > > > > Yes, Brandon is correct in this. That's one of the reasons why > > removeFromArray was created in the first place. It keeps ordinal arrays > > in the correct order when you remove an element. > > > > -- > > scott andrew lepera > > ----------------------------------- > > web stuff: www.scottandrew.com > > music stuff: www.walkingbirds.com > > _______________________________________________ > > Dynapi-Dev mailing list > > Dyn...@li... > > http://lists.sourceforge.net/mailman/listinfo/dynapi-dev > > _______________________________________________ > Dynapi-Dev mailing list > Dyn...@li... > http://lists.sourceforge.net/mailman/listinfo/dynapi-dev |