Eliminating assignments and variable syntax (accessors)

Stephen Pope stp at create.ucsb.edu
Mon Aug 2 21:08:38 UTC 1999


This is getting a bit involved, but I have another idea. First, two
principles:

1) We should keep the receiver in message patterns. (I'm against
abbreviated message-sends.)

2) We want to get rid of assignment. (It's always a hack, except if you
make it a function as in LISP, or do away with it, as in functional
languages.)

Solution: If we had the notion of "implicit accessors," we could write,

    | var |
    self var: 42.
    Transcript show: self var printString; cr.

The code that implements doesNotUnderstand (or, even better, handles the
exception MessageNotUnderstood) could then look in the local scope to
see if there's a variable named "var" and handle the assignment and
reference as "implicit accessing" -- this way it appears that we have
accessors even for local temp. vars. 

(This is very similar to several other schemes that use
doesNotUnderstand for "generic behavior" or property list objects.) 

If we did it this way, we could do away with all accessors (except for
the speed hit we'd take passing though doesNotUnderstand on IV
accesses).

stp

-- 

Stephen Travis Pope  --  http://www.create.ucsb.edu/~stp
stp at create.ucsb.edu  --  stp9 at cornell.edu





More information about the Squeak-dev mailing list