|
![](/i/fill.gif) |
Warp wrote:
> Darren New <dne### [at] san rr com> wrote:
>>> That sounds like you would need several steps of indirection in order
>>> to access a base class member using a derived class pointer.
>
>> Yep. Either that or, as I said, have the JIT do it the first time.
>
> JIT-compiling can't help if the *same* code has to handle objects of
> different types.
I'm not sure that's true.
>> Well, what I meant was that if you have Alpha::Hello() and Beta::There() and
>> you create a Gamma that inherits from both, you could actually copy the code
>> of Alpha::Hello and Beta::There into Gamma, adjusting the offsets of local
>> variables as you go. With clever vtable layout, you could have Alpha::Hello
>> and Gamma::Hello at the same offset in the vtable, and the same with
>> Beta:There and Gamma::There. (That's what Meyer invented for Eiffel.)
>
> Wouldn't that be difficult to do if Alpha and Beta are precompiled?
To machine code? Yes. That's why I said I thought Eiffel had a hard time
with that. (Doing that optimization in Eiffel takes minutes, while a quicky
test compile takes a second or two.)
In CIL? No, not that difficult, because you know what the instructions
*mean* in the CIL. Rearranging the local variables inside a class compiled
down to CIL isn't difficult.
>>> Well, the Java people added their crippled version of templates to the
>>> language regardless of all the arguments why templates are bad, so maybe
>>> there's hope that MI will also be added, regardless of all the arguments
>>> why it's bad.
>
>> Well, not templates as such. Nothing near as useful. Just generics, using
>> the same awful C++ syntax. :-)
>
> That's why I said "crippled version of templates".
In all honesty, it's a crippled version of generics, let alone templates.
They didn't even change the class file format to support it. All they did is
add sugar to do the casting from object back to the real type without you
having to type it.
--
Darren New, San Diego CA, USA (PST)
Yes, we're traveling together,
but to different destinations.
Post a reply to this message
|
![](/i/fill.gif) |