Re: Confused by behavior of LispWorks for code snippet



Tobias C. Rittweiler wrote:
Damien Kick <dkixk@xxxxxxxxxxxxx> writes:

Tobias C. Rittweiler wrote:
Damien Kick <dkixk@xxxxxxxxxxxxx> writes:

I would've expected (EQ #'F #'G) => T. I am getting that result,
i.e. (EQ #'F #'G) => T, with both Allegro CL 8.0 and Clisp. Is
LispWorks mistaken or is that an allowable result?
FUNCTION is allowed to return a fresh function object.
I don't find anything in the hyperspec which seems to support this. I
could very well be missing something, though. [...]

Well, there's 3.1.4 which says

That is, two /functions/ that are behaviorally indistinguishable might
or might not be identical.

I'm not convinced. From 3.1.4

<blockquote>
In situations where a closure of a lambda expression over the same set of bindings may be produced more than once, the various resulting closures may or may not be identical, at the discretion of the implementation.
</blockquote>

So it seems to me that this is saying that evaluating the same lambda expression more than once is allowed to produce different closures. But my reading of the text would lead me to expect (FLET ((F ...)) (EQ #'F #'F) => T but (FLET ((MAKE-F () #'(LAMBDA ()))) (EQ (MAKE-F) (MAKE-F))) => implementation-defined. In this case, the two behaviorally indistinguishable functions returned by MAKE-F might not be identical. But, again, perhaps I'm missing something. However, with the fact that even other versions of LispWorks produce the results I was expecting, I'm pretty confident that this is a bug in the version of LispWorks I was using.
.