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: eachus@spectre.mitre.org (Robert I. Eachus) Subject: Re: Problem with controlled types Date: 1998/12/14 Message-ID: #1/1 X-Deja-AN: 422292055 References: Organization: The Mitre Corp., Bedford, MA. Newsgroups: comp.lang.ada Date: 1998-12-14T00:00:00+00:00 List-Id: In article stt@houdini.camb.inmet.com (Tucker Taft) writes: > 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 ;-). Interesting. Try the following example: generic type Out_Type is private; type In_Type is new Out_Type; function Conversion(I: In_Type) return Out_Type; with Ada.Finalization; with Conversion; package Pkg is type A is private; package Inner is type B is private; function Convert is new Conversion(A,B); -- I'd use Ada.Unchecked_Conversion but that has convention Intrinsic. private type B is new Ada.Finalization.Controlled with record ... end record; end Inner; private type A is new Ada.Finalization.Controlled with record ... end record; end Pkg; Now according to Tucker, in the private part of Pkg, Convert is a dispatching operation of A, and in the private part of Inner, it is a dispatching operation of B. As written there is no body allowed so the example is legal. I could add types C and D and other generic instantiations to play futher with this. I don't think I like either interpretation of 3.9.2(12). Seriously, 3.9.2(12) says: "A given subprogram shall not be a dispatching operation of two or more distinct tagged types." It doesn't say of two visibly tagged types, so I think my example would also be illegal. -- Robert I. Eachus with Standard_Disclaimer; use Standard_Disclaimer; function Message (Text: in Clever_Ideas) return Better_Ideas is...