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,LOTS_OF_MONEY autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,8c424d8135e68278 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-12-17 10:36:21 PST Path: archiver1.google.com!news1.google.com!sn-xit-02!sn-post-02!sn-post-01!supernews.com!corp.supernews.com!not-for-mail From: "Matthew Heaney" Newsgroups: comp.lang.ada Subject: Re: Ada2005 Date: Mon, 17 Dec 2001 13:40:25 -0500 Organization: Posted via Supernews, http://www.supernews.com Message-ID: References: <9v4jsj$bd1$1@infosun2.rus.uni-stuttgart.de> <9v7f26$qn2$1@infosun2.rus.uni-stuttgart.de> <3C1754BA.C4560423@informatik.uni-jena.de> <9v7q8r$1f5$1@infosun2.rus.uni-stuttgart.de> X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4807.1700 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4807.1700 X-Complaints-To: newsabuse@supernews.com Xref: archiver1.google.com comp.lang.ada:18022 Date: 2001-12-17T13:40:25-05:00 List-Id: "Patrick Hohmeyer" wrote in message news:K2fS7.15363$Us5.3441773@news20.bellglobal.com... > In this case I find the C++ definition *way* easier to understand > than this Chapter 13 babbeling of Ada. Most of the time you don't have to think about the freezing rules -- if you try to do something that's not allowed then your compiler will tell you. This is not unlike the rules for using static_cast vs reinterpret_cast in C++. Rather than try to figure out which one to use, just use a static_cast, and then let the compiler tell you that you need to use a reinterpret_cast instead. The basic idea with freezing rules for tagged types is that all the primitive operations ("virtual methods") for a type have to be known at the point of derivation. For example: package P is type T is abstract tagged limited null record; procedure Op (O : in out T) is abstract; type NT is new T with null record; procedure Op (O : in out NT); --OK procedure Another_Op (O : in out T) is abstract; --primitive op declared too late end P; The declaration of Another_Op for type T comes too late ("after the freezing point"), because all the primitive operations have to be known at the time of declaration of type NT. (This is because they are "implicitly declared" at the point of declaration of type NT.) Here's the output of my compiler: gcc -c -Ic:\ -I- c:\p.ads p.ads:5:04: warning: no primitive operations for "T" after this line p.ads:8:14: this primitive operation is declared too late gnatmake: "c:\p.ads" compilation error The fix is simple enough: package P is type T is abstract tagged limited null record; procedure Op (O : in out T) is abstract; procedure Another_Op (O : in out T) is abstract; --OK type NT is new T with null record; procedure Op (O : in out NT); --OK procedure Another_Op (O : in out NT); --OK end P;