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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,699cc914522aa7c4 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsfeed01.chello.at!newsfeed.arcor.de!newsspool4.arcor-online.net!news.arcor.de.POSTED!not-for-mail Newsgroups: comp.lang.ada Subject: Re: Structured exception information From: Georg Bauhaus In-Reply-To: References: <1168885771.30643.20.camel@localhost> Content-Type: text/plain Content-Transfer-Encoding: 7bit Organization: # Message-ID: <1168953170.2218.108.camel@localhost> Mime-Version: 1.0 X-Mailer: Evolution 2.6.1 Date: Tue, 16 Jan 2007 14:12:51 +0100 NNTP-Posting-Date: 16 Jan 2007 14:10:46 CET NNTP-Posting-Host: 13c2d4e0.newsspool4.arcor-online.net X-Trace: DXC=QFh`4@YM^BV\9P[:DUn00Q4IUK On Mon, 2007-01-15 at 17:19 -0500, Robert A Duff wrote: > Georg Bauhaus writes: > ... > > type State is tagged record > > info: Integer; > > end record; > > > > with Handling; use Handling; > > procedure foo is > > > > x: Integer; > > > > function Env return State'class is > > begin > > return State'(info => x); > > end Env; > > > > begin > > if 1 > 1 then > > raise Constraint_Error with Env'access; > > end if; > > end foo; > > I'm not sure exactly what you mean by the above. Is Handling supposed > to be provided by the Ada implementation? Yes, I had imagined a type somewhat like (Limited_)Controlled. Randy has clarified IIUC. > Is Env'Access pointing to a > function or the result of calling the function (allocated where?)? More or less Env'Access should designate a "pure parameterless projection function" e.g. from an activation record into a special memory area used by exception handlers. When Env'Access occurs after "with" and an exception is raised, the projection is performed, that is, the necessary copying of fields is performed in an implementation specific way. The storage of the projection is typed, and access is granted in handlers only. Env is associated with the exception occurence (Ex_Obj'Environment?). A call will then return a read only tagged object of the special kind mentioned above. (Uhm, this reminds me of the composed type in Tom Moran's example, and of stream attributes :-) As a simpler approach, and a variation of what Maciej Sobczak has suggested, what if raise Constraint_Error with (Derived_from_Exception_Controlled with A => X, ...) will restrict X to be a name of a local object? Or more generally, a name of an object that has already been computed? (The type of A will have to be as visible as Derived_from_Exception_Controlled I guess.)