Charles O Nutter
6/11/2009 12:47:00 AM
On Wed, Jun 10, 2009 at 6:23 PM, Roger Pack<rogerpack2005@gmail.com> wrote:
> Currently I am thinking that an optimizer that takes
>
> class A
> =C2=A0def one_thing
> =C2=A0 =C2=A0calls_another 3
> =C2=A0end
> =C2=A0def calls_another a
> =C2=A0 =C2=A0a.to_s
> =C2=A0end
> end
>
> and converts it to C, such that one_thing calls another *in c* would be
> a good =C2=A0JIT.
It would be *one way* to jit, but it would not allow for polymorphism
(multiple target types providing the same method) or any redefinition.
Nor would it easily allow for methods to be defined at runtime, so
you'd need to make sure both methods exist and choose to statically
bind them (setting that binding in stone) for all time. In this case,
where you're doing a "self" call, as long as there's no subclass and
no method changes at runtime, it's probably ok. But of course you
don't know if it will stay that way forever.
- Charlie