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,308a261188818cce X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news1.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!wns13feed!worldnet.att.net!attbi_s22.POSTED!53ab2750!not-for-mail From: "Jeffrey R. Carter" User-Agent: Thunderbird 1.5.0.12 (Windows/20070509) MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Pointers explained? References: <1185817996.143086.317990@g12g2000prg.googlegroups.com> <1185818189.689914.159900@x40g2000prg.googlegroups.com> In-Reply-To: <1185818189.689914.159900@x40g2000prg.googlegroups.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: NNTP-Posting-Host: 12.201.97.213 X-Complaints-To: abuse@mchsi.com X-Trace: attbi_s22 1185831093 12.201.97.213 (Mon, 30 Jul 2007 21:31:33 GMT) NNTP-Posting-Date: Mon, 30 Jul 2007 21:31:33 GMT Organization: AT&T ASP.att.net Date: Mon, 30 Jul 2007 21:31:33 GMT Xref: g2news2.google.com comp.lang.ada:1279 Date: 2007-07-30T21:31:33+00:00 List-Id: shaunpatterson@gmail.com wrote: > ------- OKAY sorry... I tried to tab in and accidentally activated the > POST button ---- Once you get used to the de facto Ada standard of never using tabs in source, you won't have this problem. > Now - my solution was to re-write my message factory to return a type > Message'Class. However, I went > to change my callback structure to: > > type CallbackEvent is > record > msg : Message'Class > end record; > and I get the message "unconstrained subtype in component declaration" Right, 'Class is always an unconstrained subtype. However, you can declare objects of an unconstrained subtype, provided you provide an initial value. The object takes its constraints from the initial value: S : String := "abc"; Similarly, if you define a function F that returns Message'Class, you can declare objects of the subtype: M : Message'Class := F; This may or may not help you, because you still can't have components of an unconstrained subtype. If you need a component, you will need access types. Then good practice is to hide the use of access types from your package's clients. -- Jeff Carter "Have you gone berserk? Can't you see that that man is a ni?" Blazing Saddles 38