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

mysterious declarations off in left field



    Date: Sun, 5 May 1985  14:12 EDT
    From: "Scott E. Fahlman" <Fahlman@CMU-CS-C.ARPA>

	Don't packages offer an alternative way of scoping declarations?

    Sure, but packages normally function at a very large grain size.
    Sometimes you want to add something to a package without having to scan
    the whole package definition to ensure that some fool has not declared X
    to be a quadruple-float.

Or SPECIAL! I've already had problems in Macsyma source code with closures
that didn't "close" because someone decided STRING should be a special variable.
I guess you can imagine how that would be a pretty high-probability variable
name and a poor choice of special name ... Consider too that names like
LIST, STRING, etc. are not likely to be private -- nearly everyone is going
to inherit them from GLOBAL -- so the first time anyone in any "package"
declares one of them to be special, it screws everyone else who tries to do
compilations in that environment.

    If I bind a lexical X, that's my X and I'm not interested in anyone 
    else's views about what type X's in general should be.

Indeed.

Actually, I wonder if we shouldn't have said that type proclamations
should pertain only to special variables. eg,

 (PROCLAIM '(TYPE FLOAT TOLERANCE))

might have only applied to special occurrences of TOLERANCE. This would
mean that people using variables lexically in other modules would be far
less likely to find irrelevant declarations affecting them...

In cases where people wanted to make assertions about lexical variables,
they should perhaps have to scope such declarations lexically.

Although obviously such a change is somewhat incompatible, we might consider
it (or something like it) for the next round of revisions. (An alternate
approach which would achieve the same end would be to introduce a new
declaration operator which had the property of applying only to special 
occurrences so that people could choose which style they wanted.)

Of course this doesn't solve the problem I alluded to earlier of having
people declare things special behind my back...