[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Scheme-reports] fresh empty strings
-----BEGIN PGP SIGNED MESSAGE-----
On 01/24/2012 02:06 AM, John Cowan wrote:
> Vincent Manis scripsit:
>> In the absence of a procedure for mutating the length of a string,
>> empty strings are immutable.
> Yes, but the last few exchanges have been about non-empty but short strings.
We've all run off on tangents, and I'm afraid it might be my fault for
suggesting that implementations might well have different
representations for different lengths of strings, as an optimisation...
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, 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.
And, of course, "undefined" doesn't mean it has to return some unique
"undefined value"! Just that the implementation gets to choose.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
-----END PGP SIGNATURE-----
Scheme-reports mailing list