Re: Ordinals, Hashes, and Arrays, oh my

2004-09-11 Thread Dan Schmidt
David Green wrote: That's true. But it's got me thinking about the connection between arrays and "associative" arrays. In fact, the user doesn't need to know that a "hash" is implemented with a hash table, and an "array" isn't; and nothing stops you from using numbers as hash keys. I believe L

Re: Ordinals, Hashes, and Arrays, oh my

2004-09-11 Thread Larry Wall
On Fri, Sep 10, 2004 at 05:47:29PM -0600, David Green wrote: : On 2004/9/06, Larry Wall wrote: : : >Another possibility is that .[] always forces the "normal" view of an : >array as 0-based, and if you want non-0-based arrays you have to use : >the .{} interface instead, on the assumption that str

Re: Ordinals, Hashes, and Arrays, oh my

2004-09-11 Thread Jonathan Lang
Larry Wall wrote: > David Green wrote: > : And if you restrict your "hash" to numeric keys, Perl could notice and > : optimise it into an array. (Or integer keys, or positive integers, or > : a consecutive range of positive ints) > > What exactly do you mean by "could notice"? The point a

Re: Ordinals, Hashes, and Arrays, oh my

2004-09-11 Thread Larry Wall
On Sat, Sep 11, 2004 at 02:16:50PM -0700, Jonathan Lang wrote: : Funny you should mention that, especially considering the (relatively) : recent discussion of revamping "sort", and noting that providing an : "ordering" for a hash would essentially be the same as providing the hash : with a "default