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,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,3c256edee673e6 X-Google-Attributes: gid103376,public From: stt@houdini.camb.inmet.com (Tucker Taft) Subject: Re: Problem with controlled types Date: 1998/12/14 Message-ID: #1/1 X-Deja-AN: 422241004 Sender: news@inmet.camb.inmet.com (USENET news) X-Nntp-Posting-Host: houdini.camb.inmet.com References: Organization: Intermetrics, Inc. Newsgroups: comp.lang.ada Date: 1998-12-14T00:00:00+00:00 List-Id: Matthew Heaney (matthew_heaney@acm.org) wrote: : bourguet@my-dejanews.com writes: : > with ada.finalization; : > : > package Pkg is : > : > type A is private; : > -- operations on B : > : > type B is private; : > : > function Get_B (I: A) return B; : > -- other operations on B : > : > private : > : > type A is new Ada.Finalization.Controlled with record : > ... : > end record; : > : > type B is new Ada.Finalization.Controlled with record : > ... : > end record; : > : > end pkg; : > : > ObjectAda complain that the Get_B function is primitive on two tagged : > types, and that is not allowed. : > : > Gnat compile and run correctly (as A'Class contains only A and : > B'Class only B, this is not strange). : > : > Now, which one is correct? : GNAT is correct; ObjectAda is incorrect. : An operation cannot be primitive for more that one type is only true for : (publicly) tagged types. Since A and B and not publically tagged, : Get_B is a legal operation. Not quite true. The problem is that *inside* the package private part and the body, Get_B is primitive on two tagged types, and that is not legal. So ObjectAda wins this round ;-). -- -Tucker Taft stt@inmet.com http://www.inmet.com/~stt/ Intermetrics, Inc. Burlington, MA USA An AverStar Company