From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,1888e8caa20a2f2d X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!newshub.sdsu.edu!elnk-nf2-pas!newsfeed.earthlink.net!stamper.news.pas.earthlink.net!newsread1.news.pas.earthlink.net.POSTED!a6202946!not-for-mail From: "Jeffrey R. Carter" Organization: jrcarter at acm dot org User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.12) Gecko/20050915 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Controlled types and exception safety References: <8sKdnXNeIZMxIg3eRVn-ig@comcast.com> <3trncoj4t0va.19bs46zhm4xbe.dlg@40tude.net> <2Rklf.171$n1.114@newsread2.news.pas.earthlink.net> In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Message-ID: Date: Wed, 07 Dec 2005 01:57:30 GMT NNTP-Posting-Host: 67.3.217.98 X-Complaints-To: abuse@earthlink.net X-Trace: newsread1.news.pas.earthlink.net 1133920650 67.3.217.98 (Tue, 06 Dec 2005 17:57:30 PST) NNTP-Posting-Date: Tue, 06 Dec 2005 17:57:30 PST Xref: g2news1.google.com comp.lang.ada:6757 Date: 2005-12-07T01:57:30+00:00 List-Id: 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