At 10:04 AM 11/7/2001 -0600, Dave Goehrig wrote:
>On Wed, Nov 07, 2001 at 03:41:54PM -0500, Ken Fox wrote:
> > Dan Sugalski wrote:
> > > my $foo;
> > > $foo = 12;
> > > print $foo;
> > > $foo /= 24;
> > > print $foo;
> >
> > Well, there's only two assignments there,
>
>It isn't even two assignment, hell, it reduces to: 120.5
>literally
If you'll notice, the original code had a disclaimer on it that it was
simple on purpose, for illustrative purposes.
What level of constant folding and other optimizations perl allows is
somewhat up in the air, but generally speaking very little is safe in perl.
(Or python, or ruby, for that matter) Yes, the optimizer phase, which most
compile-and-go executions will almost completely bypass, may in some
circumstances be able to cut code down.
The original question was whether vtable methods could be inlined. The
answer to that is no. The vtable methods are black boxes, and should stay
that way. In the cases where the generic behavior of a thing is guaranteed
then yes, the optimizer can do some simplifications and rearrangements, but
as the behaviour of the core variable types isn't necessarily guaranteed,
we can't always do that.
Dan
--------------------------------------"it's like this"-------------------
Dan Sugalski even samurai
[EMAIL PROTECTED] have teddy bears and even
teddy bears get drunk