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

Issue: PROCLAIM-LEXICAL (Version 4)



The idea, presented in PROCLAIM-LEXICAL versions 2-4, that special
variables have corresponding "cells", really bugs me.  It means that
binding and unbinding are to be thought of as side-effects.  The
environment model of binding seems much more elegant and modular to me;
note that the McCarthy's original Lisp interpreter, Steele's Art of the
Interpreter, and Scott/Strachey-style descriptions of programming
languages, even dynamically scoped languages, all describe binding in
terms of environments.  If I were describing the semantics of Common
Lisp, I'd say that the inputs to the (semantic) interpreter were: an
expression, a lexical environment (for lexical variables, block names,
declarations, etc.), a dynamic environment (for special variables, catch
tags, and unwind-protections), a store (to find the values currently
stored in locations like the cars and cdrs of conses), and a
continuation.  Now it's certainly possible to have a "cell" model of
evaluation which is completely equivalent to this; you just multiplex
the store and dynamic environment arguments, and make sure that
unbinding happens at the right time.  These two semantic models
correspond to deep- and shallow-bound implementations, which as we all
know are equivalent as far as their behavior is concerned.

I would be much happier if the description of special variables was in
terms of dynamic environments rather than in terms of "cells" and
side-effects.  This is what I was beginning to try to do with version 1
of the proposal.  (The actual behavior of Common Lisp is less important
to me than its mode of description, so long as I can do what I want to
do, which versions 1-4 all do.)  It's easier to derive the shallow
semantics from the deep semantics than vice versa, and it's
correspondingly easier for users and implementors to understand.  The
environment model also adheres more closely to standard practice in the
rest of the programming languages community -- although I guess the Lisp
community has never been afraid of provincialism before...