On Thu, 14 Feb 2002, Dave Mitchell wrote:
> > $foo would first be a Dog, then a FireHydrant. When it changed to a
> > FireHydrant the previous contents would get blown away.
>
> Hmmm - how do we distinguish between a plain scalar that is temporarily
> typed, and a 'proper' permanently-typed scalar?
>
> eg in the following
>
> my Dog $spot = Dog.new("waggly tail");
> $spot = Cat.new();
>
> you would expect $spot to always remain a dog no matter what, and will
> throw a run-time (or compile time) error if it can't think of a way of
> making itself into a "doggish" cat.
I think you're thinking at too high a level to make much sense of what
the vtables should be doing. A better example to drive your mind would
be:
tie $foo, 'Baa';
$foo = 12;
In which case the $foo PMC will know that it is somehow tied, and dispatch
control to an appropriate bit of perl code.
> it's current vtable pointer, and if so, under what circumstances
> are we allowed to change the pointer? Do we need a PMC flag saying
> that our type is fixed? And if so, how do we handle
PMCs define how a variable behaves in different circumstances. We can
change the pointer in every instance except those where the receiving
PMC does not let us, in general a PMC will be happy to lose its
identity.
Alex Gough
--
#!/usr/bin/perl
use Quantum::Entanglement qw(:DEFAULT :complex);
$language = entangle(1,'python',1/i,'C',i*i,'Perl',1/i**2,'Java',i**5,'C#');
print "Just another $language hacker,\n" if $language eq 'Perl';