On Wed, Nov 07, 2001 at 11:50:00AM -0500, Dan Sugalski wrote: > I mean "Change which table of functions is in effect for a > variable at this point in time".
I honestly, still don't think that makes a lick of difference, though I admit I may be introducing an "out of context problem". > my $foo; This says to me "Add a scalar PMC to my pad Mr. Parrot". > $foo = 12; This says to me "Mr. Parrot, that either call method 'set' on scalar's vtable, or scratch that last pad entry I just found the number 12, lets pretend I[n] is called "foo", and ignore all this scalar nonsense." Please bear with me, this is going somewhere. > print $foo; Now either, this says "Mr. Parrot, call method 'print' of scalar's vtable" or we pretending that "$foo" is at all relavent, and are just pretending that value is a scalar. If we're playing lets pretend, because we know better, it says "Mr. Parrot use that print_i on that register we were preteneding was called $foo". > $foo /= 24; And so on... > print $foo; And so on... > may well have the vtable pointer attached to the PMC for $foo change with > every line of code. Probably will, honestly. Just because there is a "variable" known affectionately as "$foo" in perl think space, doesn't mean, that any such PMC, etc need exist in Parrot space. A better example of what you described might be: my $foo = new Balloon color => red; ($foo -> PMC -> vtable of class Balloon... blah blah blah) $foo->pop(); (Balloon's vtable entry for pop was indexed... balmo) $foo = new BaseBall lace_color => red; ($foo -> PMC -> vtable of class Balloon... blah blah blah ) Well guess what, we just suscribed to a falacy that the perl variable foo is at all relavent to the VM. We could have as easily conceived it as something else... Perl Parrot C $foo -> PMC1 -> vtable of class Balloon $foo -> PMC2 -> vtable of class BaseBall now PMC1 & PMC2 may both back point to a $foo name in Parrot, but we usually don't care. When compiling the byte code, we want to keep track of PMC1 vs PMC2 and don't give a damn about $foo. >From the Perl programmer's perspective the vtable changed, but the compiler waves its magic hands, and Parrot doesn't see it that way. I brought up the whole low level integer rewrite stuff above, because look at it again. That is eactly what we are meant to do when we know it is safe to optimize a variable to a more limited domain than say 'scalar'. We don't even go through the motions of vtables. Then again, what the hell do I know...