From: ytomino <aghia05@gmail.com>
Subject: Re: Problem in "X (1).Re := X (1).Re + 1"
Date: Wed, 9 May 2012 04:03:22 -0700 (PDT)
Date: 2012-05-09T04:03:22-07:00 [thread overview]
Message-ID: <28665682.73.1336561402311.JavaMail.geo-discussion-forums@pbnh4> (raw)
In-Reply-To: <15071427.1562.1336550750742.JavaMail.geo-discussion-forums@pbcia3>
On Wednesday, May 9, 2012 5:05:50 PM UTC+9, ytomino wrote:
>
> I still don't think it's impossible.
> How about inserting the copy-on-write code into Constant_Reference?
I reconsidered.
X : Vector;
-- insert items into X
Ref1 := V.Constant_Reference (X, 1); -- reference counter = 1
Z := X; -- reference counter = 2
Ref2 := V.Constant_Reference (X, 2); -- (E) what should it do?
If simple copy-on-write is executed at E, Ref1.Element will be an old value.
Probably, Reference/Constant_Reference should disable the container from increasing the reference counter.
X : Vector;
-- insert items into X
Ref1 := V.Constant_Reference (X, 1); -- reference counter = 1, and locking it
Z := X; -- deep copy, keeping reference counter = 1
Ref2 := V.Constant_Reference (X, 2); -- OK
Otherwise, more complicated mechanism like ownership control is required.
prev parent reply other threads:[~2012-05-09 11:05 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-05 12:55 Problem in "X (1).Re := X (1).Re + 1" ytomino
2012-05-07 15:37 ` Adam Beneschan
2012-05-07 18:53 ` ytomino
2012-05-07 21:28 ` Adam Beneschan
2012-05-08 1:14 ` Randy Brukardt
2012-05-08 17:14 ` Adam Beneschan
2012-05-08 22:29 ` Randy Brukardt
2012-05-09 8:41 ` ytomino
2012-05-10 0:52 ` Randy Brukardt
2012-05-10 5:23 ` ytomino
2012-05-09 9:29 ` ytomino
2012-05-10 0:58 ` Randy Brukardt
2012-05-10 4:26 ` ytomino
2012-05-15 6:09 ` Randy Brukardt
2012-05-15 20:17 ` ytomino
2012-05-16 0:01 ` Randy Brukardt
2012-05-15 22:12 ` Simon Wright
2012-05-16 7:14 ` Dmitry A. Kazakov
2012-05-09 8:05 ` ytomino
2012-05-09 11:03 ` ytomino [this message]
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox