unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: Andy Wingo <wingo@pobox.com>
To: ludo@gnu.org (Ludovic Courtès)
Cc: 13741-done@debbugs.gnu.org
Subject: bug#13741: guile-2.0: optimize, and eq-ness of literals (test-suite)
Date: Mon, 18 Feb 2013 18:19:23 +0100	[thread overview]
Message-ID: <87bobha6as.fsf@pobox.com> (raw)
In-Reply-To: <87k3q67zhy.fsf@gnu.org> ("Ludovic Courtès"'s message of "Mon, 18 Feb 2013 10:16:57 +0100")

On Mon 18 Feb 2013 10:16, ludo@gnu.org (Ludovic Courtès) writes:

> Daniel Hartwig <mandyke@gmail.com> skribis:
>
>>   scheme@(guile-user)> (define x 1/2)
>>   scheme@(guile-user)> (eq? x 2/4)
>>   $7 = #f
>>   scheme@(guile-user)> ,optimize (eq? x 2/4)
>>   $8 = (eq? x 1/2)
>>   scheme@(guile-user)> (define y 2/4)
>>   scheme@(guile-user)> (eq? x y)
>>   $9 = #f
>>   scheme@(guile-user)> ,optimize (define y 2/4)
>>   $10 = (define y 1/2)
>
> Quoth R5RS:
>
>      `Eq?''s behavior on numbers and characters is
>      implementation-dependent, but it will always return either true or
>      false, and will return true only when `eqv?' would also return
>      true.  `Eq?' may also behave differently from `eqv?' on empty
>      vectors and empty strings.
>
> What we may get wrong is that it looks as if it doesn’t always return
> either true or false, because the behavior depends on whether one of the
> operands is a literal.
>
> However, it’s fundamentally wrong to rely on eq? to compare numbers.  So
> the test case you mention seems buggy, to start with.

Agreed, FWIW.  Fractions are allocated on the heap, and eq? picks out
the difference between heap objects.  Sometimes two values are the same
object, and sometimes not.

Closing the bug, but please follow up with any questions.

Cheers,

Andy
-- 
http://wingolog.org/





  parent reply	other threads:[~2013-02-18 17:19 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-18  3:27 bug#13741: guile-2.0: optimize, and eq-ness of literals (test-suite) Daniel Hartwig
2013-02-18  9:16 ` Ludovic Courtès
2013-02-18 10:02   ` Daniel Hartwig
2013-03-01 16:13     ` Mark H Weaver
2013-02-18 17:19   ` Andy Wingo [this message]
2013-02-18 23:48   ` Mark H Weaver
2013-02-19  1:55     ` bug#13741: [PATCH] test-suite: eq-ness of numbers, characters is unspecified Daniel Hartwig
2013-02-19  4:29       ` Daniel Hartwig
2013-02-19  5:19       ` Mark H Weaver
2013-03-01 16:10         ` Mark H Weaver

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87bobha6as.fsf@pobox.com \
    --to=wingo@pobox.com \
    --cc=13741-done@debbugs.gnu.org \
    --cc=ludo@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).