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

Re: The variables +, -, *, and /



> From: Tim McNerney <TIM@MIT-MC.ARPA>
> Subject:  The variables +, -, *, and /
> 
> It seems unfortunate that the variables +, -, *, and / were reserved
> for use by the Top-Level Loop.  This choice of names makes it difficult
> to build the run-time environment for Scheme-like language that
> compiles into Common Lisp and that supports the illusion that there are
> no separate function and value cells.  If these variables had not been
> reserved, one could
> 
>     (DEFCONSTANT + #'+)
>     (DEFCONSTANT * #'*)
>     etc...
> 
> so that
> 
>     ((IF SUM? + *) X Y) 
> 
> could be simply compiled into
> 
>     (FUNCALL (IF SUM? + *) X Y)

Perhaps these symbols aren't the real problem:  CL compilers tend to
have built-in knowledge about certain special forms that a user can't
easily modify.  So if you're really scheming up a language with
different semantics for the functional position of a form, you'll
probably have to write new top-level loops for both compiler and
interpreter which preprocess all top-level forms appropriately.  Your
top-level interpreter loop would probably have a reentrant top-level
unwind-protect so the user doesn't ever fall out into the CL one, even
during error recovery.  Thus, the CLtL top-level loop won't be around
to mess with +, ++, etc.