Re: [Scheme-reports] fresh empty strings Alaric Snell-Pym (23 Jan 2012 13:28 UTC)
Re: [Scheme-reports] fresh empty strings Andy Wingo (23 Jan 2012 15:23 UTC)
Re: [Scheme-reports] fresh empty strings Alaric Snell-Pym (23 Jan 2012 15:34 UTC)
Re: [Scheme-reports] fresh empty strings Ray Dillinger (23 Jan 2012 20:17 UTC)
Re: [Scheme-reports] fresh empty strings Andy Wingo (23 Jan 2012 20:52 UTC)
Re: [Scheme-reports] fresh empty strings John Cowan (23 Jan 2012 23:05 UTC)
Re: [Scheme-reports] fresh empty strings Vincent Manis (24 Jan 2012 01:02 UTC)
Re: [Scheme-reports] fresh empty strings John Cowan (24 Jan 2012 02:06 UTC)
Re: [Scheme-reports] fresh empty strings Alaric Snell-Pym (24 Jan 2012 09:37 UTC)
Re: [Scheme-reports] fresh empty strings John Cowan (24 Jan 2012 15:10 UTC)
Re: [Scheme-reports] fresh empty strings xacc.ide@gmail.com (24 Jan 2012 16:31 UTC)
Re: [Scheme-reports] fresh empty strings Per Bothner (24 Jan 2012 17:21 UTC)
Re: [Scheme-reports] fresh empty strings Andy Wingo (24 Jan 2012 17:00 UTC)
Re: [Scheme-reports] fresh empty strings Aubrey Jaffer (24 Jan 2012 02:16 UTC)

Re: [Scheme-reports] fresh empty strings John Cowan 24 Jan 2012 15:08 UTC

Alaric Snell-Pym scripsit:

> Bringing it back to reality, however, I think it's fine and good for eq?
> of strings to be defined as it is. Two references to the same string
> should probably be eq? - (let ((a str) (b str)) (eq? a b)) - so that
> they're useful in hash tables,

Indeed.  (let ((a x) (b x)) (eq? a b)) is always true, except where x is
a character or number.

> but two references to strings with the
> same content should be left undefined to give implementations scope for
> implementing strings as in-memory objects, yet still being able to
> implement them as immediates or merging known identical strings together
> or whatever: (let ((a "hello") (b "hello") (eq? a b)) should not be
> defined by the standard.

Racket, Gauche, MIT, Gambit, Chicken, Bigloo, SISC, Chibi, Chez, SCM,
Ikarus/Vicare, Mosh, KSi, SigScheme, Tinyscheme, Scheme 9, Dream, Scheme 7,
BDC, XLisp, Rep, Schemik, Elk, UMB, Oaklisp, and Owl Lisp all return false.
Scheme48/scsh, Guile, Kawa, Larceny, Ypsilon, IronScheme, NexJ, STklos,
Shoe, RScheme, JScheme, VX return true.  There may be some false negatives
here, because an implementation might coalesce literals in the compiler
but not at the REPL.

I was quite surprised by how many implementations take the trouble to
return true.

> And, of course, "undefined" doesn't mean it has to return some unique
> "undefined value"! Just that the implementation gets to choose.

Naturally.

--
John Cowan    http://ccil.org/~cowan    cowan@ccil.org
Economists were put on this planet to make astrologers look good.
        --Leo McGarry

_______________________________________________
Scheme-reports mailing list
Scheme-reports@scheme-reports.org
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports