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

Re: defconstant vs. lexical variables



    Date:  6 May 1985 15:40 edt
    From:  OLDMAN at USC-ISI
    Subject:  defconstant vs. lexical variables

    Page 69 of the CLM states:

    "Once a name has been declared by defconstant to be constant, any
    further assignment to or binding of that special variable is an
    error.  ...  A compiler may also choose to issue warnings about
    bindings of the lexical variable of the same name."

    Question: How can I make a lexical binding of the thing if it's
    implicitly proclaimed special by the defconstant?

    Alternate question: Why don't we have a way of declaring
    something locally lexical?

    --Dan Oldman {Data General}



Answer:
    (defun foo (lex-x) ...)

    (proclaim '(special lex-x))    ; Compiler should warn me
                                   ; when it hits this statement.

Alternate answer:
    I don't know.  I think we should also.  Until then, one should
    stick to the convention of surrounding special vars. with *'s.
    This should reduce the chance of unknowingly using a var. that
    has been proclaimed special.