Andy Wingo <wi...@pobox.com> 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:http://www.gnu.org/prep/standards/standards.html#Non_002dGNU-Standards>

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