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

Re: Implementing :TEMPORARY hash tables at the Lisp level?



    Date: Wed, 7 Sep 88 18:26:30 BST
    From: Jeff Dalton <jeff%aiai.edinburgh.ac.uk@NSS.Cs.Ucl.AC.UK>

    Functions can be compared with EQ, EQL, and EQUAL,

Function objects can, but not the results of invocations of the FUNCTION
special form.  On p.89, CLtL says, "a perfectly valid implementation
might simply cause every distinct evaluation of a FUNCTION form to
produce a new closure object not EQ to any other."  The precise behavior
of the FUNCTION special form in this regard will frequently depend on
whether the code is compiled or interpreted and whether the argument is
a global function name, a local function name, or a lambda expression.

For example, in Symbolics Common Lisp the function

(defun fn-eq-test (a)
  (flet ((internal () (cons a a)))
    (eq #'internal #'internal)))

returns NIL when interpreted, but T when compiled.  The interpreter
definition of FUNCTION simply makes a new lexical closure, while the
compiler collapses equivalent lexical closures.

                                                barmar