[Top][All Lists]

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

Re: Bug in documentation for eq? ?

From: David Kastrup
Subject: Re: Bug in documentation for eq? ?
Date: Wed, 20 Jun 2012 16:27:42 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (gnu/linux)

Andy Wingo <address@hidden> writes:

> Hi,
> [bunch of examples]
>> Which of the above would you consider unspecified?
> As the Scheme standard clearly states, all the ones comparing numbers
> with eq?.  You find some of them surprising; that is your problem ;)  The
> answer is to not compare numbers with eq?.

You are confused.  I am not comparing numbers when writing (eq? x x).
I am checking the identity of an object.  Whether that object is a
number or not, and if so, what value it has, is irrelevant.

If the Scheme standard states that

(and (pair? x) (not (eq? (car x) (car x))))

can return #t in a conforming implementation, that means that the
standard failed to do its job for weeding out implementations with
unusable behavior.

But that does not mean that a given implementation should consider
unusability to be a worthwhile goal.

Cf. <URL:>

I would consider it an extremely bad idea if Guile (or for that matter,
any other Scheme implementation) would ever produce anything but #t for
(eq? v v) regardless of what v has been bound to.  And I see no point in
threatening the user that it might do so in an alternate universe.

Again: it is fine if an optimizer chooses not to track object identities
for numeric values.  But if it doesn't, it needs to assume they are eq?
when equal rather than some random choice.

David Kastrup

reply via email to

[Prev in Thread] Current Thread [Next in Thread]