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.3 required=5.0 tests=BAYES_00,FREEMAIL_FROM, INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII X-Google-Thread: 103376,3b7d2943d4e48cd3 X-Google-Attributes: gid103376,public From: Damien Carbonne Subject: Re: generic formal primitive [dispatching] operation Date: 2000/09/19 Message-ID: <39C92E15.5EA5FACE@free.fr>#1/1 X-Deja-AN: 671785012 Content-Transfer-Encoding: 8bit References: <39C5321E.805A73D1@free.fr> X-Accept-Language: en Content-Type: text/plain; charset=iso-8859-1 X-Complaints-To: abuse@proxad.net X-Trace: nnrp5.proxad.net 969399132 212.27.44.165 (Tue, 19 Sep 2000 23:32:12 CEST) Organization: Guest of ProXad - France MIME-Version: 1.0 NNTP-Posting-Date: Tue, 19 Sep 2000 23:32:12 CEST Newsgroups: comp.lang.ada Date: 2000-09-19T00:00:00+00:00 List-Id: Robert A Duff a �crit : > Damien Carbonne writes: > > > I would like to create a generic package that has, as formal parameters, > > a tagged type and some primitive dispatching operations on that type. > > Try using a generic formal derived type. Declare the root type outside > the generic, with the primitive you want, and then declare a generic > formal type derived from that. > As I explained in my answer to Thomas Quinot, I would like to avoid this solution, because it is a bit more rigid than what I expect. But if what I expect is impossible, I will come back to it. > > > 1) How is it possible to define a formal primitive operation on a tagged > > type that is: > > a) non dispatching (Root'Class ??) > > Primitive = dispatching (for tagged types). Class-wide types are not > primitive. > > > b) dispatching > > See above. > > > 2) In the case of class-wide operations, is there any difference between > > primitive and non primitive > > operations ? (I would say no ?) > > A class-wide operation is *not* primitive. > > - Bob Sorry, I thought "primitivity" was only related to declarative region + freezing rules. But it is in fact more restricted. Is the following example correctly labelled ? package P is type T is tagged null record; procedure Primitive(Obj : T); procedure Class_Wide(Obj : T'Class); end P; with P; use P; package O is procedure What_Is_Its_Category(Obj : T); procedure Again_Class_Wide(Obj ; T'Class); end O; Can we consider that in the following declarations: generic type Root is tagged private; with procedure P1(This : access Root); with procedure P2(This : access Root'Class); 1) P1 is primitive (that is dispatching). Root can be derived and P1 redefined. (It seems to be the case in the example I put in my answer to T.Quinot) 2) P2 is class-wide. If this is true, my problem is, how is it possible to make the initial example work, keeping the same spec (just changing the body). Thanks for clarifications. Damien.