[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: (OT) Re: memory management



Keith Lucas wrote:

> >That's C++ for you! Some would think that Smalltalk and Java cheat at
> >this (you can change a parent class without recompiling the childrens)
> >by being partly interpreted, but ObjC does it too and its compiled, so
> >(to borrow some of my Quadra non-customers) C++ must be broken. :-)
> 
> Erm. Objective C is essentially run-time interpreting a lot of stuff.

Yes, of course. That's why it is cool. ;-)

> Java in fact is even closer to the C++ model, it just dynamically links
> things a lot later...

The important part is that Java doesn't have vtables, just like
Objective-C. The guy doing Java admitted a while ago that Objective-C
was quite an inspiration. Darn, interface == protocol, and just compare
Java's Object with ObjC NSObject (for OpenStep flavors), quite similar,
up to the little "hash" method, and many common words have different
senses in Java and C++ (they don't seem to be reusing C++ terminology,
just the words).

> You could probably solve the problem in C++ by just compiling each class
> into a separate library and dynamically linking them just before running.

Wouldn't work. The kickers is vtable layout: if it changes, you're
f**ked.

But there's this interesting thing in newer egcs (that I don't have)
about a thunk-based virtual method lookup... It does makes many people
scream tho (libraries compiled in this way are incompatible with
vtable-based libraries).

-- 
Pierre Phaneuf
Ludus Design, http://ludusdesign.com/
"First they ignore you. Then they laugh at you.
Then they fight you. Then you win." -- Gandhi