[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: EQness of functions
- To: "Steve Bacher (Batchman)" <@sail.stanford.edu:SEB1525@draper.com>, firstname.lastname@example.org
- Subject: Re: EQness of functions
- From: Jeff Dalton <jeff%aiai.edinburgh.ac.uk@NSS.Cs.Ucl.AC.UK>
- Date: Fri, 16 Sep 88 15:19:05 BST
- In-reply-to: Steve Bacher (Batchman)'s message of Fri, 16 Sep 88 07:09 EDT
> The case of
> (let ((f #'(lambda ...)))
> (eq f f))
> has no bearing on the issue of whether (eq f #'eq) is valid. #'eq means
> (function eq), which may or may not result in something being done at
> run time to evaluate it; f is a variable reference whose value has already
> "been evaluated" at some prior time. (eq f f) ought to always be true,
> modulo some kinds of number-optimization.
It is clear at least they we are not understanding each other.
I will try again nonetheless. The problem may be that I am
talking about what FUNCTION should be and you seem to be talking
about what it is.
I want #'F to be a reference in the function namespace just as
plain F is a reference in the value namespace.
Consider the following in Scheme:
(let ((f (lambda ...)))
(eq f f))
This will return true. In Common Lisp, I might write it as:
(let ((f #'(lambda ...)))
(eq f f))
but I might prefer:
(flet ((f ...)) (eq #'f #'f))
I do not think that this additional transformation (into FLET) should
introduce any new uncertainty w.r.t. EQ -- because #'F, like F, is
just a reference (whose value has already been evaluated). The
relevance of the LET example is that it and the FLET version should
(in my view) be equivalent.
Put another way, I suggest that FUNCTION should be interpeted as
more or less a syntactic marker as in
<form> ::= ... | (FUNCTION <function>) | ...
<function> ::= <identifier> | (LAMBDA <lambda list> <form>*)
That is, (LAMBDA ...) in, say, ((LAMBDA ...) ...) has as its value
a function; (LAMBDA ...) in (FUNCTION (LAMBDA ...)) is interpreted
in more or less the same way; but in (... (LAMBDA ...) ...) it is not
[it's interpreted as a call to the (non-)function LAMBDA]. So in
the <identifier> case, FUNCTION simply indicates that the identifier
is a function name, not a variable.
In other words, I do not think of FUNCTION as an operation that
constructs a value -- it's not like LIST or MAKE-SYMBOL. Furthermore,
I am not saying that Common Lisp currently treats FUNCTION in the way
I prefer -- I am saying that (in my opinion) it should.
Finally, recent messages have shown that the "may make a new object
each time" view of (FUNCTION <identifier>) provides some freedom that
can be exploited in various ways. Whether this freedom is important
enough to determine the semantics is less clear.
I hope everyone isn't *too* tired of this.