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

Issue: PROCLAIM-LEXICAL



In reply to JAR:

        Not true.  You can suppress this warning by saying (proclaim '(special
        <var>)) or (defvar <var>).

    *Not* not true!  Look again at the example.
    ...
    I don't know how you develop code, but I like to get my programs into
    a condition where they do not elicit warnings from the compiler.

OK, if you really want to use the same names for your specials and your
lexicals, then indeed there is no good way to get rid of the warning.  I
hardly ever do this, so I missed your point.  When I see that warning in
a case like your example program, it tells me that it's time to rename
something, not that I should find some way to inhibit the warning with a
declaration.

I assume that we're not going to consider any radical proposals for the
handling of specials, such as separating the name spaces by making the
*foo* syntax mandatory for specials.  If we stay close to the status
quo, it seems to me that we really should go ahead and add a LEXICAL
declaration and a LEXICAL proclamation so that those pervasive special
proclamations can be cancelled or shadowed.  I haven't heard any good
arguments against this in the last N years.  The need to eliminate
spurious "not declared or bound" warnings is one argument in favor of
this change, but it would be a useful change for other reasons in any
case.

    Why is this any different from an undefined function, which is not
    similarly warned about?  I believe these two situations (forward
    reference to a variable and to a function) should be treated
    symmetrically.

No difference in principle.  Both conditions are suspicious and worth a
warning, in my view, but how such warnings are handled is up to the
implementor.  It is desirable to emit these warnings when the suspicious
condition is noticed; that way the location of the problem is marked and
the user has the option of aborting the compilation.  In the case of
undefined functions, forward references are particularly common, so most
implementations wait till the end of the compilation before emitting the
warning.  In the case of undeclared specials, there does not seem to be
a good reason to wait, so we warn at once.

        As a separate issue, we might want to try to hammer out a proposal for
        what people have called "global lexicals", and we might even want to
        make this the default for undeclared symbols used free.

    If you look at the proposal carefully you'll see that it contains
    exactly this; namely, in the GENERAL and RESTRICTED alternatives, you
    can do (PROCLAIM '(LEXICAL ...)).  I'm wondering how you missed
    it...

I didn't miss it.  Your GENERAL and RESTRICTED proposals seem to re-open
a debate that we had some time ago on "global" or "global lexical"
variables and what their semantics should be.  A lot of hairy issues
came up in that discussion, and I didn't see those issues being
addressed here.  So my suggestion was that we ought to separate this
issue from the business about inhibiting warnings and try to come up
with a comprehensive proposal on global variables -- comprehensive in
the sense that we try to deal with all the issues raised in the earlier
discussion.

-- Scott