comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Problem in "X (1).Re := X (1).Re + 1"
Date: Tue, 15 May 2012 19:01:06 -0500
Date: 2012-05-15T19:01:06-05:00	[thread overview]
Message-ID: <jouqo4$lba$1@munin.nbi.dk> (raw)
In-Reply-To: 29152338.116.1337113067360.JavaMail.geo-discussion-forums@pbcjt7

"ytomino" <aghia05@gmail.com> wrote in message 
news:29152338.116.1337113067360.JavaMail.geo-discussion-forums@pbcjt7...
...
> Sorry, I can't understand what is your argument, and probably my words are 
> lacking again.
> If a Standard container that's implemented A.18.2(254.a) is existing, 
> should not it behave similarly
> to the normal version (no sharing version) Standard container? I think 
> yes.

Yes, of course.

> Naturally error checkings have to be inserted. But, in the cases that the 
> normal version container
> does not raise any exceptions, the sharing version should try to make 
> coherence by doing a trick
> at its hidden side, instead of raising a exception. I feel that it has 
> been an implicit promise.

Quite right. But my point was that the examples you showed would almost 
certainly fail the tampering check in the Standard containers (*any* correct 
implementation) - so long as you have a valid pointer to an element, you 
cannot tamper with the container (tampering prevents certain types of 
modifications). So those examples would raise an exception, and the 
reference counting problems would never arise (because the modification is 
prevented).

The tampering check allows a wide variety of ways to manage the elements of 
a container, but probably not *every* possible way. And it should be obvious 
that any time you have a pointer into part of a container, you have to be 
very careful about what operations are allowed while that pointer exists. 
That might prevent some sorts of implementations, but it is the nature of 
pointers. (If that's really a problem for a custom container, don't use 
them!).

                                Randy.





  reply	other threads:[~2012-05-16  0:01 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 [this message]
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
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox