[124] in java-interest
Re: Binding in Java
daemon@ATHENA.MIT.EDU (David Hopwood)
Fri May 26 16:50:10 1995
From: David Hopwood <david.hopwood@lady-margaret-hall.oxford.ac.uk>
Date: Fri, 26 May 1995 18:45:27 +0000 (BST)
To: java-interest@java.Eng.Sun.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]) ();
[snip]
> 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.
Point taken; I should have said 'In almost all implementations of
C++, ...'.
(However, it's important to recognize that this model of implementation
did influence many of the higher-level design decisions in C++).
David Hopwood
david.hopwood@lmh.ox.ac.uk
-
Note to Sun employees: this is an EXTERNAL mailing list!
Info: send 'help' to java-interest-request@java.sun.com