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

selective linking in Lisp

[my attempt to reply directly to jrl@zermatt failed; he posted his
question here, so I'll reply here]

    This is an intriguing statement. Can you amplify on this. Is it the use
    of symbols both as first class objects and as names that causes the
    problems or is it something else?

Depends on what you mean by that.  You can't do reliable selective linking
on a program that calls EVAL (or its kin such as SYMBOL-VALUE,
SYMBOL-FUNCTION, etc) unless the linker can determine the arguments
that are passed to EVAL, which is impossible in general.  The reason EVAL
defeats selective linking is that the argument to EVAL, being a computed
quantity, potentially refers to just about any procedure or variable.
This is true in all Lisps, including Scheme.

The problem with Lisps other than Scheme is that all sorts of standard
procedures are specified in such a way that they potentially call EVAL
(or SYMBOL-VALUE or SYMBOL-FUNCTION), so even if you scrupulously avoid
calling EVAL yourself you still lose because you call FUNCALL or APPLY
or something else that calls EVAL (or SYMBOL-VALUE or SYMBOL-FUNCTION).

I raised this with the Common Lisp cleanup subcommittee and at the last
X3J13 meeting, and was astounded to learn that the Common Lisp vendors
generally feel that selective linking isn't worth thinking about.  They
may be right, in the sense that it would take a fairly drastic overhaul
of Common Lisp to make it possible to write reliable selective linkers.
I expect most vendors will eventually write unreliable selective linkers
that ignore the problems posed by EVAL and its kin, or else they will
rely on the programmer to declare all variables that might be needed by
a call to EVAL.  This might well be good enough for government work.

Peace, Will Clinger
Tektronix Computer Research Lab