At 03:45 PM 2/7/2001 -0200, Branden wrote:

>Dan,
>
>I think there is a real problem with your vtable approach. It involves
>tying, overloading and assignment. I'm not sure if I really got what you
>meant with the PDD, but I'm assuming:
>1. PMC's replace SV*.

Yes.

>2. Tying is handled by vtables that implement set_* and get_* entries to do
>the magic stuff.

No.

>3. Overloading is handled by vtables that implement add/subtract/mul/...
>entries to do the magic stuff.

No.

>4. There's only one vtable for each class of variables, i.e. all variables
>tied to class X share the same vtable, and all objects that have overloading
>defined by class Y share the same vtable (this seems obvious, since it's the
>vtables that define the behaviour in case of tying/overloading).

No. Well, it's not a requirement, though generally there'll be one vtable 
per class. There's nothing wrong with constructing a custom vtable for a 
PMC, though that's wasteful when carried to extremes.

>5. On a $a = $b assignment, the PMC correspondent to $a after the assignment
>is the same it corresponded before it. I.e. $a is set to the value of $b by
>calling set_* methods of $a passing some information of $b or $b itself as
>parameters, and not replaced with a new generated PMC derived from $b
>somehow.

No.

There is no one-to-one correspondence between a PMC and a perl variable. 
Yes, each variable has a PMC, but that doesn't mean that a perl variable 
has to have the *same* PMC it starts out with.

If there's nothing otherwise preventing it, there's no reason that in this 
code:

   $a = "foo";
   {
     my $b = 12;
     $a = $b;
   }

the PMC that $a has at the end is the same one that $b had, and the PMC 
that $a originally had is now garbage.

Given the answers to your questions, we can assume:

1) The rest of the message isn't really germane, as the assumptions its 
based on were incorrect
2) The explanations in the vtable PDD suck in some profound ways
3) There needs to be some more scaffolding documentation around the vtable PDD.

                                        Dan

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

Reply via email to