Re: SRFI 130 - "span" prefix John Cowan 05 Dec 2015 16:51 UTC

Shiro Kawai scripsit:

> Gauche's GC doesn't move objects, but for copying GCs, one way is to keep
> the pointer to the head of the original string and the offset.

Sorry, I wasn't clear.  Consider this:

gosh> (define foo (make-string 1000000 #\z))
foo
gosh> (define bar (substring foo 1 999998)) ; presumably shares with foo
bar
gosh> (begin (string-set! foo 500000 #\Z) 42) ; suppresses lengthy output of string-set!
42
gosh> (string-ref bar 499999)
#\z

Now when the string-set! was executed, the sharing between foo and bar
strings had to be broken somehow, because we see that mutating foo did
not affect bar.  How does that work?

--
John Cowan          http://www.ccil.org/~cowan        xxxxxx@ccil.org
But the next day there came no dawn, and the Grey Company passed on
into the darkness of the Storm of Mordor and were lost to mortal sight;
but the Dead followed them.          --"The Passing of the Grey Company"