Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!decwrl!shelby!neon!craig From: craig@Neon.Stanford.EDU (Craig D. Chambers) Newsgroups: comp.object Subject: Re: Do we really need types in OOPL's? Message-ID: <1990Oct3.203122.21273@Neon.Stanford.EDU> Date: 3 Oct 90 20:31:22 GMT References: <3832@osc.COM> <3851@m5.COM> Organization: Stanford University Lines: 34 In article <3851@m5.COM> tma@m5.UUCP (Tim Atkins) writes: >In article cline@sun.soe.clarkson.edu (Marshall Cline) writes: >>Static binding says the compiler knows (from the text of the program alone) >>the exact member function that will be called. Dynamic binding and static >>typing coexist wonderfully, existence proofs being C++, Simula, Eiffel, etc. > > I take a bit of exception to C++ in this context. Dynamic binding >means that that binding is done a run-time based on the run-time type of >the receiver and the message sent. C++ emphatically does not support this. >Instead it uses static type information to calculate the offset relative >to a type specific pointer location within the receiver where the function >may be found. There is no run-time lookup at all except to simply do the >simple array reference. C++ *does* support dynamic binding, implemented in cfront (and most (all?) other C++'s) using indirect procedure calls (as you describe). The fact that this implementation may be more efficient than some other run-time dispatching implementations (such as table lookups) doesn't mean it's not dynamic binding. Of course, the C++ class/type rules have been designed so that this implementation is possible. Adding multiple inheritance has so complicated this implementation that some of the other implementations, perhaps coupled with optimizations like inline caching and/or customization, may start to look more attractive. And I'd like to add that Trellis/Owl is the best example of an existing statically-typed object-oriented language I'm aware of, as far as flexibility (and correctness) in the type system. >>Marshall Cline >- Tim Atkins -- Craig Chambers