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

Issue: PROCLAIM-LEXICAL (Version 7)

    In fact I have been unable to think of any way to implement
    this proposal in a fully shallow-bound system.

The problem is that the proposal requires that SPECIAL global references
and LEXICAL global references share the same value when there has been
no SPECIAL binding, but do not share when there has been a SPECIAL binding.
In a fully shallow-bound system (i.e. no environment search in SPECIAL
references and none in LEXICAL global references), this means that the
first SPECIAL binding has to do something unusual to separate the SPECIAL
value from the LEXICAL value, and the last SPECIAL unbinding has to undo

Having turned my brain back on, I have now thought of an efficient way
to do this on Lisp machines, using invisible pointers, and another
efficient way to do it on stock hardware, using one extra instruction
on every global reference of one or the other sort, plus a few extra
instructions in SPECIAL binding and unbinding.  Given that, I no longer
object to the proposal as unimplementable.  However, I still think you
need to be more forthcoming about the cost to the implementor: it doesn't
just require a few compiler changes, it requires some reimplementation
of the representation of global variables, with concomitant changes to
the compiler, the loader, the interpreter, and probably the debugger.
Every symbol now potentially has two values accessible from the
interpreter (the current SPECIAL and the global LEXICAL) and you need
the corresponding new data structure to keep track of that.

A more cogent objection is that the proposal is incomplete.  Common Lisp
includes a bunch of mechanisms related to global SPECIAL variables
(DEFVAR, SYMBOL-VALUE, MAKUNBOUND, etc.) and some or all of this needs
to be replicated for LEXICAL variables.  I suspect not all of it needs
to be replicated, but you've got to discuss and decide.

I still think it would be good to do something resembling this.