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

Re: [Scheme-reports] fresh empty strings

On 01/24/2012 08:30 AM, xacc.ide@x wrote:
>> I was quite surprised by how many implementations take the trouble to
>> return true.
> What trouble? The underlying framework of my scheme does that for me :)
> I suspect the Java ones to be the same (due to string interning).
> One problem though is making sure
> (let ((a "foo")) (eq? a (string-copy a)))
> returns false.

You can use java.lang.String for Scheme string literals, in which
case Java does the interning for you.  But then you need to use some
other class for mutable strings - so it's not that simple!

(Kawa does use separate Java classes for mutable and immutable strings,
though it didn't used to - and I'm thinking about adding another class to
support O(1) indexing of strings containing non-basic-plane characters.)
	--Per Bothner
per@x   http://per.bothner.com/

Scheme-reports mailing list