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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,d80cdc1b3ff5b2f9 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-10-14 13:46:01 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!canoe.uoregon.edu!arclight.uoregon.edu!wn4feed!wn2feed!worldnet.att.net!204.71.34.3!newsfeed.cwix.com!sjc-peer.news.verio.net!news.verio.net!iad-read.news.verio.net.POSTED!not-for-mail Message-ID: <3BC9F97C.34CB@li.net> From: Vincent Marciante X-Mailer: Mozilla 3.0 (OS/2; I) MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Simple Question 3 References: <9q49v5$6dj$1@trog.dera.gov.uk> <9qcmt9$8n1$1@newsg1.svr.pol.co.uk> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Sun, 14 Oct 2001 16:45:48 -0400 NNTP-Posting-Host: 168.191.55.112 X-Complaints-To: abuse@verio.net X-Trace: iad-read.news.verio.net 1003092360 168.191.55.112 (Sun, 14 Oct 2001 20:46:00 GMT) NNTP-Posting-Date: Sun, 14 Oct 2001 20:46:00 GMT Organization: Verio Xref: archiver1.google.com comp.lang.ada:14485 Date: 2001-10-14T16:45:48-04:00 List-Id: I don't remember the RM paragraph reference but the "problem" is not to do with the definition of what a primative subprogram is, it is that primative functions derived from a tagged type that return a value of the derived type do not/can not _inherit_ their implementation from the ancestor type. A new implementation must be provided - that is made explicit by forcing the declaration of those functions to appear for any derived types. (or something like that ;) Vinny Stephen Cole wrote: > > "Stephen Cole" wrote in message > news:9q49v5$6dj$1@trog.dera.gov.uk... > > Hi > > > > Question 3..... > > > > package MyTstTypes is > > type MyRcd is tagged > > record > > a: Integer; > > b: Float; > > end record; > > > > function Unit return MyRcd; > > > > type MyNewRcd is new MyRcd with > > record > > c: Integer; > > end record; > > > > -- function Unit return MyNewRcd; > > > > type MyNewRcd2 is new MyNewRcd with > > record > > d: Float; > > end record; > > > > end MyTstTypes; > > > > The compiler complains with the following text.... > > > > "mytsttypes.ads:10:09: type must be declared abstract or "Unit" > overridden" > > > > It wants me to define a version of Unit() for each derived type?! Why? > > > > > > Look....people...my confusion is deeper than that. Its about this whole > question of what a primitive operation is! Is it a function/procedure which > takes a derived type parameter and/or returns a derived type? Or is it just > functions which return a derived type only? Or what? The rules seem a bit > fuzzy and inconsistent here. Why does returning a derived type seem to have > more rules about what must be later declared in a derived type, than > function/procedures that just take that derived type as a parameter? > > Example > Look at the following code.... > > package MyTest is > > type MyTestType1 is tagged > record > a: Integer; > b: Float; > end record; > > function UnitA(a: MyTestType1) return Integer; > function UnitB(a: MyTestType1) return MyTestType1; > function UnitC return MyTestType1; > > type MyTestType2 is new MyTestType1 with > record > c: Integer; > end record; > > end MyTest; > > UnitA() does not get flagged by the compiler as needing to be declared for > MyTestType2. But UnitB() and UnitC() do! But they all hold enough type > information for the compiler to be "intelligent" enough to know where static > matching takes place or not. The way the compiler is behaving, its as if it > only takes into account "out" parameters and does not care what "in" > parameters look like. My case is futher confussed by the use of class wide > types. But I'll come back to that if you can answer this static-only case > for me first. > > Thanks.