On Wed 04 Jan 2012 12:14, David Kastrup <d...@gnu.org> writes: > Andy Wingo <wi...@pobox.com> 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. Andy -- http://wingolog.org/