From: "Jeffrey R. Carter" <spam@spam.com>
Subject: Re: Controlled types and exception safety
Date: Wed, 07 Dec 2005 01:57:30 GMT
Date: 2005-12-07T01:57:30+00:00 [thread overview]
Message-ID: <ekrlf.267$Tg2.247@newsread1.news.pas.earthlink.net> (raw)
In-Reply-To: <IaOdnUGlFKBcewjeRVn-vA@megapath.net>
Randy Brukardt wrote:
>
> For an another explanation of this, see ARM 7.6(17.a-17.h).
> http://www.adaic.com/standards/95aarm/html/AA-A-5-3.html
Is it meaningful that you reference 7.6 and provide the URL of 5.3?
> The other issues are solveable, but this one is not.
This still doesn't seem like a problem to me. Suppose R is a discriminated
record with default:
type R (D : D_Type := D_Type'First) is record
...
end record;
and we want to write Assign:
procedure Assign (To : in out R; From : in R);
1st thing is to check if To is constrained; if so, From must have matching
constraints:
if To'Constrained and then To.D /= From.D then
raise Constraint_Error;
end if;
If To is unconstrained, and we need to (be able to) change the constraints, we
use an intermediate object:
Not_Constrained : declare
Result : R (D => New_D);
begin -- Not_Constrained
-- Assign to components of Result
To := Result; -- or R'Bitwise_Copy (To => To, From => Result);
end Not_Constrained;
Maybe I'm still missing something. Anyway, I never thought user-defined
assignment was a real need. Limited types and Assign procedures seem adequate to
me. What Ada 83 really lacked was finalization. While I'm glad Ada 95 has it, I
think I'd prefer
for R'Finalize use ...;
--
Jeff Carter
"English bed-wetting types."
Monty Python & the Holy Grail
15
next prev parent reply other threads:[~2005-12-07 1:57 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-11-30 13:57 Controlled types and exception safety Maciej Sobczak
2005-11-30 15:06 ` Dmitry A. Kazakov
2005-11-30 16:19 ` Maciej Sobczak
2005-12-01 0:05 ` Stephen Leake
2005-12-01 9:21 ` Dmitry A. Kazakov
2005-12-01 10:46 ` Maciej Sobczak
2005-12-01 15:08 ` Dmitry A. Kazakov
2005-12-02 4:17 ` Randy Brukardt
2005-12-02 9:29 ` Maciej Sobczak
2005-12-02 18:12 ` tmoran
2005-12-02 19:15 ` Robert A Duff
2005-12-02 21:42 ` tmoran
2005-12-06 9:00 ` Maciej Sobczak
2005-12-06 9:50 ` Dmitry A. Kazakov
2005-12-06 18:34 ` Jeffrey R. Carter
2005-12-06 19:34 ` Randy Brukardt
2005-12-06 21:20 ` Dmitry A. Kazakov
2005-12-07 1:57 ` Jeffrey R. Carter [this message]
2005-12-08 0:50 ` Randy Brukardt
2005-12-08 19:37 ` Jeffrey R. Carter
2005-12-09 2:36 ` Randy Brukardt
2005-12-09 6:33 ` Jeffrey R. Carter
2005-12-09 20:35 ` Randy Brukardt
2005-12-10 7:53 ` Jeffrey R. Carter
2005-12-06 20:43 ` Dmitry A. Kazakov
2005-12-07 2:00 ` Jeffrey R. Carter
2005-12-07 10:01 ` Dmitry A. Kazakov
2005-12-02 23:21 ` Robert A Duff
2005-11-30 17:46 ` Jean-Pierre Rosen
2005-11-30 21:02 ` Jeffrey R. Carter
2005-11-30 22:06 ` Björn Persson
2005-11-30 23:52 ` Randy Brukardt
2005-12-01 5:26 ` Jeffrey R. Carter
2005-12-02 23:51 ` Robert A Duff
2005-12-06 11:41 ` Peter C. Chapin
2005-12-06 12:50 ` Jean-Pierre Rosen
2005-12-06 13:06 ` Dmitry A. Kazakov
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox