[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
> I don't have his original message, but his proposal was something like
> this (ala ML): The expression ``(VAR E1)'' would allocate a cell
> containing the value of E1, and return a reference to it. If X is
> bound to such a reference, then ``(GET-VAR X)'' returns the value in the cell,
> and ``(SET-VAR! X E2)'' replaces the value in the cell with the value of E2.
> Now, VAR is nothing more than a ``one-slot CONS''. GET-VAR is the
> one-slot version of CAR/CDR, and SET-VAR! is the one-slot version of
> SET-CAR!/SET-CDR!. So, why does it make the language so
I withdraw most of my insult (which was "unclean"). It doesn't make the
language unclean. It's actually quite nice.
But I don't withdraw all of it. My point was that, in general (with most
abstract datatypes), stuffing a value into a location is the wrong thing to
do, and typically will break the abstraction. So, I want SETF in the
language, as the way to set an arbitrary mutable object. There is a
difference in connotation, if not denotation, between (SETF (VAR X) Y) and
(SET-VAR! X Y): the SETF emphasizes the abstraction, the SET-VAR! emphasizes
the pointers. Once we have SETF, I don't see any particular point to
SET-VAR!; hence my opinion that the language would be cleaner without it.
For that matter, Nihkil's "one-slot CONS" is a nice little mutable abstract
data type, and a good one with an efficient implementation. Just the thing
for building a lot of the abstract data types with mutators, I imagine.
-- Bard the (LAMBDA (X) GARGOYLE)
- From: Rishiyur S. Nikhil <NIKHIL@XX.LCS.MIT.EDU>