At 10:26 AM -0700 7/21/02, Scott Walters wrote:
>It is pretty clear that no one is happy with the keyed system. It
>doesn't do what people want (eg, let you use arrays as keys).
>While keys are supposed to be fast, constructing them takes a series
>of instructions.
>
>Perspective:
>
>Keys are not needed. They are an optimization over the interpreter
>doing a series of lookups in containers using scalar keys.
No. They are not. You're missing the important case where the data
structure is inherently and intrinsically multidimensional.
my int Array @foo : dimensions(3);
@foo[1;2;3] = 12;
Or whatever the syntax is in perl to declare a 3D array and access
the element at (1,2,3).
@foo is a three-dimensional array of integers. There is none of
perl's arrays of refs to arrays of refs nonsense--@foo is a single
PMC. On top of that, each of its elements is *not* a PMC, it is an
integer.
>If we
>stuck to that premise, limiting the scope, lots of ugly bad things
>would go away.
I still fail to see any ugly bad things. (And, bluntly, I don't much
care if something's ugly if it provides a speed win, and bad is a
value judgement that I don't think is appropriate here)
>I propose that keyed access do exactly eight things:
>
>* fetch a PMC using a key
>* fetch a integer using a key
>* fetch a number using a key
>* fetch a string using a key
>* store PMC
>* store int
>* store num
>* store string
No. Keyed access for all methods stays. You're forgetting one very
important case, the one where the contents of an aggregate isn't a
PMC. This scheme would then require the aggregate PMC to construct
fake PMCs to do operations on. Bad, definitely bad.
--
Dan
--------------------------------------"it's like this"-------------------
Dan Sugalski even samurai
[EMAIL PROTECTED] have teddy bears and even
teddy bears get drunk