Email list hosting service & mailing list manager

SRFI 130 - "span" prefix Per Bothner (04 Dec 2015 03:34 UTC)
Re: SRFI 130 - "span" prefix John Cowan (04 Dec 2015 15:54 UTC)
Re: SRFI 130 - "span" prefix Per Bothner (04 Dec 2015 16:10 UTC)
Re: SRFI 130 - "span" prefix taylanbayirli@xxxxxx (04 Dec 2015 16:49 UTC)
Re: SRFI 130 - "span" prefix John Cowan (05 Dec 2015 07:05 UTC)
Re: SRFI 130 - "span" prefix John Cowan (06 Dec 2015 06:44 UTC)
Re: SRFI 130 - "span" prefix Shiro Kawai (04 Dec 2015 18:49 UTC)
Re: SRFI 130 - "span" prefix John Cowan (05 Dec 2015 07:06 UTC)
Re: SRFI 130 - "span" prefix Shiro Kawai (05 Dec 2015 07:21 UTC)
Re: SRFI 130 - "span" prefix John Cowan (05 Dec 2015 16:51 UTC)
Re: SRFI 130 - "span" prefix Per Bothner (05 Dec 2015 17:20 UTC)
Re: SRFI 130 - "span" prefix Shiro Kawai (05 Dec 2015 17:39 UTC)
Re: SRFI 130 - "span" prefix John Cowan (05 Dec 2015 20:00 UTC)
Re: SRFI 130 - "span" prefix Alex Shinn (04 Dec 2015 16:52 UTC)
Re: SRFI 130 - "span" prefix Shiro Kawai (04 Dec 2015 20:27 UTC)
Re: SRFI 130 - "span" prefix John Cowan (07 Dec 2015 00:02 UTC)
Re: SRFI 130 - "span" prefix Shiro Kawai (07 Dec 2015 07:57 UTC)
Re: SRFI 130 - "span" prefix John Cowan (07 Dec 2015 13:09 UTC)
Re: SRFI 130 - "span" prefix John Cowan (06 Dec 2015 02:32 UTC)
Re: SRFI 130 - "span" prefix Alex Shinn (07 Dec 2015 19:26 UTC)
Re: SRFI 130 - "span" prefix John Cowan (07 Dec 2015 19:48 UTC)
Re: SRFI 130 - "span" prefix Shiro Kawai (07 Dec 2015 20:08 UTC)
Re: SRFI 130 - "span" prefix John Cowan (07 Dec 2015 20:25 UTC)
Re: SRFI 130 - "span" prefix Shiro Kawai (07 Dec 2015 20:44 UTC)

Re: SRFI 130 - "span" prefix Per Bothner 05 Dec 2015 17:19 UTC


On 12/05/2015 08:51 AM, John Cowan wrote:
> 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?

The easiest way seems to be a copy-on-write flag.  If substring returns
a mutable string, you need the flag on both foo and bar.

This is what I'm doing in the new (in-progress) Kawa re-implementation
of strings and arrays.
--
	--Per Bothner
xxxxxx@bothner.com   http://per.bothner.com/