At 06:08 PM 2/7/2001 -0200, Branden wrote:
>Dan Sugalski wrote:
> > Splitting the vtable into two pieces, with one piece not tied to a PMC,
> > makes some things impossible. Consider this:
> >
> >    @foo = @bar * @baz;
> >
> > where all three arrays are really matrix types.
>
>By the PDD's notion of `key', what would be the `key' of a matrix type ?

Probably an integer, possibly a list for multidimensional matrices. (And I 
haven't thought about how to handle that--probably force a series of index 
lookups)

>(I think that's actually a -language question, but) What $foo[42] (where
>@foo is matrix) would compile to?

Identically to how $foo[42] would if @foo were a plain array.

> > In the separate load/store
> > and do vtable scheme it means you get the value of @bar and @baz in scalar
> > context, and multiply the results. Two operations, and the resultant
>values
> > are sanitzed. In the single vtable scheme, we'd execute @bar's multiply
> > routine, which would be clever enough (because we wrote it that way) to
>see
> > the second parameter's also a matrix, and do matrix math.
> >
>
>Actually, not necessarily. It depends of what the compiler does... There
>could be special entries for array operations, like +/-/*/... . The problem
>I see with it is what happens when you @a = @b. Actually, if @b is a matrix,
>@a = @b makes @a a matrix or evaluates @b in list context?

That's a language issue. I don't know--I can see it going either way. I'd 
prefer a straight assign and let the assignment vtable entry handle it, but 
I don't know that we'll have that option.

>What about @a =
>(@b) ?

Good question. I'd like to see it handled the same way as @a=@b, but I'm 
not sure that's going to happen. It's Larry's decision. (Mainly because I'd 
like to see this:

   @a = (@b, @c);

turn into:

   @a = @b;
   push @a, @c;

but I don't know that we'll be able to)

>What if @a is a tied array?

What if? Larry's call as to whether it makes @a a copy of the data from @b, 
or creates a new tied thing, or an alias. Probably @a would be a plain copy 
of @b with no magic, but that's not my call.

>This matrix thing is actually getting
>very confusing to me... I think all these proposed additions to the language
>should be carefully examined for possible mis-interpretations like these.

I'm not proposing they go in (well, OK, I am, but I'm not forcing it). What 
I am doing is trying to not preclude the possibility if its decided that it 
will happen.

                                        Dan

--------------------------------------"it's like this"-------------------
Dan Sugalski                          even samurai
[EMAIL PROTECTED]                         have teddy bears and even
                                      teddy bears get drunk

Reply via email to