Re: Clean Object Class Design -- Circle/Ellipse

From: Dave Harris <brangdon_at_cix.co.uk>
Date: Thu, 18 Oct 2001 15:27 +0100 (BST)
Message-ID: <memo.20011018152743.28767A_at_brangdon.madasafish.com>


bbadour_at_golden.net (Bob Badour) wrote (abridged):
> Overriding setFoci does not prevent me from sending the message, does
> it?

Smalltalk is dynamically type-checked, so you can send the message whether or not the object is an instance of Ellipse or Circle. Circle can override setFoci to behave much the same as if the method had not been inherited. In Smalltalk, subclassing and subtyping are independent.

> If Smalltalk made sufficient distinction between values and variables,
> one would not need to override setFoci in the Circle class because it
> would never inherit the method. Circle values would inherit the
> operations on Ellipse values but Circle variables would not inherit
> the operations on Ellipse variables.

Are there languages which work like that? Which ones? It might help me to see an independent rendition of your vision.

Are you sure you're not confusing inheritance with subtyping? What methods a subclass inherits has little to do with whether it is mutable. It may effect whether it is a subtype.

  Dave Harris, Nottingham, UK | "Weave a circle round him thrice,

      brangdon_at_cix.co.uk      |   And close your eyes with holy dread,
                              |  For he on honey dew hath fed
 http://www.bhresearch.co.uk/ | And drunk the milk of Paradise." Received on Thu Oct 18 2001 - 16:27:42 CEST

Original text of this message