[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: semantics of DEFINE (why use it at all on the top level?)



In article <890503-103409-9762@Xerox> Pavel.pa@XEROX.COM writes:

>-- A program is a mixed sequence of definitions and expressions.
>	
>-- The meaning of a program P is the same as that of the following expression:
>		    ((lambda  (I*)  P')  <undefined>  ...)
>where I* is the set of variables defined in P (i.e., appearing as the CADR
>of a DEFINE form), P' is the sequence of expressions obtained by replacing
>each definition in P with the corresponding assignment, and <undefined> is
>an expression producing some useless value.

Then why not actually do this?

-- The scheme top-level environment has each variable bound to a unique
   location.  Many of these locations will be assigned the value #\undefined.

-- The user can assign other values to variable locations using "set!".
   A "define" on top level will be an error, since the variable is
   already bound on that level.

-- Allow the syntax "(set! (first cell) (car cell))" to mean the analogue
   of the comparable "define" syntax
-- 
						Biep.  (biep@cs.vu.nl via mcvax)
	Who am I to doubt the existence of God?   I am
	  only a simple man,  I already have trouble
	enough doubting the existence of my neighbour!