Re: Clean Object Class Design -- Circle/Ellipse

From: Dave Harris <brangdon_at_cix.co.uk>
Date: Mon, 1 Oct 2001 00:00 +0100 (BST)
Message-ID: <memo.20011001000009.35593A_at_brangdon.madasafish.com>


bbadour_at_golden.net (Bob Badour) wrote (abridged):
> Ask him to point to any Smalltalk language definition that defines
> "instance" as anything other than a variable which one can reference.

The 1997 draft of the ANSI Smalltalk standard (which is the version of the standard I have to hand), says:

    A /variable/ is a computational entity that stores a single     reference (the /value/ of the variable) to an object.

    [...] An /object/ is a computational entity which is capable of     responding to a well defined set of messages. An object may     also encapsulate some (possibly mutable) state.

This is *not* saying an object is a variable. It explicitly allows for objects which have no state, in addition to objects whose state is not mutable, and objects with mutable state. The defining property of an object is its ability to respond to messages, not whether or not it has state.

(The ANSI standard does not define "instance". It uses "object" instead. Later it says that when an object does have state, it represents it with special kind of variables called "instance variables". In other words, an object is not a variable but an object can contain variables.)

> An instance or variable can have the value 5. The value, however, is
> not an instance.

So sorry, but in Smalltalk the value 5 is an instance of the class SmallInteger.

> One cannot reference a value. Values are self-identifying.

Indeed 5 is self-identifying. We can send a message to the value 5 whether or not we have a variable referring to it.

> According to the definition of the Smalltalk language an instance is a
> variable that one can reference.

Again, so sorry, but my reading of the ANSI definition of Smalltalk says that an instance (or object) is something which responds to messages.

Perhaps you are talking about some other language, also called Smalltalk? How confusing! Can you point me to a definition of your language? Definitions of ANSI Smalltalk are available from:   http://minnow.cc.gatech.edu/squeak/172

  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 Mon Oct 01 2001 - 01:00:45 CEST

Original text of this message