|
 |
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.
> > And checks
> > for this would need to be done for *all* accesses, even in situations where
> > there's no inheritance at all (because the code which tries to access the
> > object through the pointer cannot know if the object it was given was a
> > derived object or not, without always checking).
> 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?
> > 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".
--
- Warp
Post a reply to this message
|
 |