Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!usc!elroy.jpl.nasa.gov!jpl-devvax!lwall From: lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) Newsgroups: comp.lang.perl Subject: Re: = @array? Message-ID: <7163@jpl-devvax.JPL.NASA.GOV> Date: 24 Feb 90 18:50:18 GMT References: <15193@bfmny0.UU.NET> <1990Feb23.190121.2591@iwarp.intel.com> <15202@bfmny0.UU.NET> Reply-To: lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) Organization: Jet Propulsion Laboratory, Pasadena, CA Lines: 38 In article <15202@bfmny0.UU.NET> tneff@bfmny0.UU.NET (Tom Neff) writes: : Just for the record, if I toss something out for discussion right now : it's NOT because I want it to go in Patch 9! Like everyone else, I : await that patch with no further embellishment (and eagerly!). The problem is that it takes 4-5 contiguous hours to put a patch together and test it, and the usual embellishment only takes an hour or so to add. : Now, how about easy array inserts and deletes via slice operations? : : push(@array[1..$n], $elt1, $elt2...); : and : $elt = pop(@array[1..$n]); It's kindof weird to use array slices for that, since you have to supply useless information. And the semantics of slices are that they are equivalent to a list of individual scalars, which I don't want to change. What we need is some equivalent to the substr() function when used as an lvalue--if the thing you assign is the same length, it changes in place; if it's longer, the array grows, and if it's shorter, the array shrinks. Assignment to a slice would be a reasonable syntax, but that already means something different, alas. And what would $elt = pop(@array[1,8,4]) mean? Perhaps subary(@array, $n, 0) = ($elt1, $elt2, ...); # your push $elt = $array[$n]; # your pop subary(@array, $n, 1) = (); Open to suggestions. Larry