[122] in java-interest

home help back first fref pref prev next nref lref last post

Re: Binding in Java

daemon@ATHENA.MIT.EDU (John Barton)
Fri May 26 16:22:01 1995

To: java-interest@java.Eng.Sun.COM
Date: Fri, 26 May 1995 08:51:38 -0400
From: John Barton <jjb@watson.ibm.com>

>> > > > #3. Am I correct in thinking that, like C++, the compiler
>> > > > knows either
>> > > > A) The address of the destination method, or
>> > > > B) The address of a pointer to the destination method
>> > > > in every case, at compile time?
>> > >
>> > > No. Everything is bound lazily at runtime.
>> >
>> > Yes, but there are various ways of doing runtime binding.
>> > In C++, each class has a vtable (array of pointers to methods),
>> > and the offset within that table for each call is known statically.
>> > The code for a dynamic call is something like:
>> > *((*(receiver->vtable)) [offset]) ();
>>
>> Unfortunately, if the offset changes you have to recompile your
>> program. That makes C++ a very bad choice for writing long lived
>> libraries.
>
>Yes, I agree.

  I think its important that we do the right kinds of comparisons.

  In C++, each class does *NOT* have a vtable, the offset within
that table is *NOT* known statically, and the code for a dynamic
call is *NOT* as described above.  Neither the language
description nor upcoming standard dictates anything like the above.

  Most existing C++ implementations do use the object model outlined
above.  The reason is simple: most C++ programmers will trade
long lived libraries for high performance.  There is a role for
increased indirection:  developers need faster turn around and
large systems builders need more modularity.  Delta-C++ from Silicon
Graphics demonstrates success of an alternative object model for
developers; Fresco with single process CORBA and MetaWare/IBM
with DirectToSOM demonstrate sucess with an alternative object model
for large systems.

  I think Java is very exciting; I think its good to compare it to
other languages and implementations.  C++ gets bashed a lot; I think
we should be studying the real reasons for its success as much as we
study its problems.

John.

John J. Barton        jjb@watson.ibm.com            (914)784-6645
	<http://www.research.ibm.com/xw-SoftwareTechnology>
H1-C13 IBM Watson Research Center P.O. Box 704 Hawthorne NY 10598

-
Note to Sun employees: this is an EXTERNAL mailing list!
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post