[Top][All Lists]

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

Re: Guile: What's wrong with this?

From: Andy Wingo
Subject: Re: Guile: What's wrong with this?
Date: Wed, 04 Jan 2012 12:32:26 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux)

On Wed 04 Jan 2012 12:14, David Kastrup <address@hidden> writes:

> Andy Wingo <address@hidden> writes:
>> We could add a compiler option to turn string literals into
>> (string-copy FOO).  Perhaps that's the thing to do.
> What for?  It would mean that a literal would not be eq? to itself, a
> nightmare for memoization purposes.

  (eq? "hello" "hello")

This expression may be true or false.  It will be true in some
circumstances and false in others, in all versions of Guile.

> And for what?  For making code with explicitly undefined behavior
> exhibit a particular behavior that is undesirable in general.

The Scheme reports and the Guile manual are both positive and negative
specification: they require the implementation to do certain things, and
they allow it to do certain others.  Eq? on literals is one of the
liberties afforded to the implementation, and with good reason.  Correct
programs don't assume anything about the identities (in the sense of
eq?) of literals.


reply via email to

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