A declarative model of Smalltalk (was Re: [DOCS] SUnit tests)

Richard A. O'Keefe ok at cs.otago.ac.nz
Mon Feb 24 02:49:21 UTC 2003

"Jeff Read" <bitwize at snet.net> wrote:
	Smalltalk appears to borrow a lot from LISP in this regard, at
	least in terms of philosophy if not implementation.  In Scheme, for
	instance, the keyword define means "Add this symbol to your currently
	running global environment, and bind it to the following value..."

Actually, it doesn't.  Any Scheme block (Algol sense) may contain
"defines", and they add to the LOCAL scope, not the GLOBAL scope.
The Scheme standards (both ISO Scheme and RnRS Scheme) explain how
(<stuff> (define x1 e1) ... (define xn en) <more stuff>)
is equivalent to
  (letrec ((x1 e1)
           (xn en))
    <more stuff>))

For example,
    (define (sort Xs)
     (define (merge Xs Ys) ...)
does NOT introduce a global definition for merge.

The Scheme standards define entire Scheme programs in which ALL functions
are explicitly present when compilation starts (of course Scheme has closures
constructed at run time, but the lambda-expressions they are constructed from
are explicitly present at compile time).

	The difference, if I surmise correctly, is that every Scheme
	knows what define means; the base semantics for the keyword are
	standardized -- whereas each Smalltalk has a different protocol for
	creation of classes and adding methods to them.
ANSI Smalltalk defines a "declarative" representation for classes and
global variables.  It is intended as an interchange format between
different Smalltalk implementations.

More information about the Squeak-dev mailing list