when should sends be virtual?
rainer at physik3.gwdg.de
Thu Jan 19 10:30:57 UTC 1995
maybe part of this mess is caused by the fact that my first experiences
with oop were (turbo)pascal and c++:
urs, you wrote:
> One problem with letting the sender decide whether a call is virtual
> (dispatched) or not is that it breaks encapsulation. The receiver should
> decide what happens with a message send, and statically binding the send
> (e.g. to invoke an overriden method) is like writing instance variables
in turbopascal/c++ it's true that virtual calls are dispatched and the
others are not (statically bound). but that doesn't mean that virtual
equals dispatched. dispatching or not is somewhat of an implementational
difference, i wasn't talking about that. virtual as i see it is a matter
of semantics (see replies to guenter and randy).
> In other words, you can't reason about the object's properties and
> invariants anymore by simply looking at the object's definition.
More information about the Self-interest