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

Re: [Scheme-reports] fresh empty strings



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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.

ABS

- --
Alaric Snell-Pym
http://www.snell-pym.org.uk/alaric/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk8ee34ACgkQRgz/WHNxCGo44ACfRff0mIqLLo3D4oRhYQdgJ6uy
fjcAoJFkyQLBZYoQUQID+P3rPGWC9+CE
=fFzF
-----END PGP SIGNATURE-----

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