At 03:41 PM 11/7/2001 -0500, Ken Fox wrote:
>Dan Sugalski wrote:
> > my $foo;
> > $foo = 12;
> > print $foo;
> > $foo /= 24;
> > print $foo;
> >
> > may well have the vtable pointer attached to the PMC for $foo change with
> > every line of code. Probably will, honestly.
>
>Well, there's only two assignments there, so I assume that print is
>going to upgrade the scalar to have a string rep. Are you thinking of
>scalar representations something like:
>
> undef
> integer
> integer_with_string
> real_with_string (dirty)
> real_with_string
Yup, something like that.
>I like the principle of automatically changing representations, but
>shouldn't the compiler be a little smarter? In this example every
>expression has a static type.
Right, but it's just an example. It's simple on purpose. Yes, I know the
optimizer can potentially do a bunch of constant folding. No, that's not
the point.
>Which brings up an interesting question. Does Perl the language
>require just-in-time representation changes
Yes, at the moment it does. And I think, though it's not fixed in stone
yet, that we need to cope with global changes to the vtable entries of core
data types. (We certainly need to for Ruby support, but that's a separate
issue)
Dan
--------------------------------------"it's like this"-------------------
Dan Sugalski even samurai
[EMAIL PROTECTED] have teddy bears and even
teddy bears get drunk