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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,d80cdc1b3ff5b2f9 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-10-14 00:54:13 PST Path: archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!isdnet!proxad.net!feeder2-1.proxad.net!news1-1.free.fr!not-for-mail Message-ID: <3BC943E8.DB044D8D@free.fr> Date: Sun, 14 Oct 2001 09:51:04 +0200 From: Jean-Marc Bourguet X-Mailer: Mozilla 4.7 [en] (X11; I; Linux 2.2.10 i586) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Simple Question 3 References: <9q49v5$6dj$1@trog.dera.gov.uk> <9q6k2r$p8g$1@trog.dera.gov.uk> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Organization: Guest of ProXad - France NNTP-Posting-Date: 14 Oct 2001 09:54:12 MEST NNTP-Posting-Host: 212.27.55.176 X-Trace: 1003046052 news1-1.free.fr 207 212.27.55.176 X-Complaints-To: abuse@proxad.net Xref: archiver1.google.com comp.lang.ada:14475 Date: 2001-10-14T09:54:12+02:00 List-Id: Stephen Cole wrote: > > I would have thought that the compiler should just through the assignment X > := Unit() out, because it does not statically match. I do not see why the > compiler has the right to demand you write a Unit() function for the derived > type. Is there a deeper reason why it does? I think you did not understood what you did. You created Unit as a primitive operations of a tagged type which returns a value of this type. The rules of Ada imply that all non abstract derived types have to override the definition of this function. You probably didn't want to declare a primitive operation. There are two solutions: return a classwide type (so it will not return a value of the type) or declare the function in another package (so it will not be a primitive operation). Declaring it in a nested package and providing a renaming will give you what you though you had declared . -- Jean-Marc