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 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,dad94612ff745427 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news4.google.com!news.glorb.com!tudelft.nl!txtfeed1.tudelft.nl!feeder1.cambrium.nl!feed.tweaknews.nl!194.100.2.60.MISMATCH!fi.sn.net!newsfeed2.fi.sn.net!newsfeed3.funet.fi!newsfeeds.funet.fi!newsfeed.kolumbus.fi!feeder2.news.jippii.net!feeder1.news.jippii.net!nntp.inet.fi!inet.fi!newsfeed1.nokia.com!news1.nokia.com!not-for-mail From: rick H Subject: Re: Instantiating private types with discriminants? Newsgroups: comp.lang.ada References: <1147183013.687672.246320@g10g2000cwb.googlegroups.com> Organization: home User-Agent: tin/1.8.1-20060215 ("Mealasta") (UNIX) (CYGWIN_NT-5.1/1.5.19(0.150/4/2) (i686)) Message-ID: Date: Tue, 09 May 2006 14:24:13 GMT NNTP-Posting-Host: 172.26.210.110 X-Complaints-To: newsmaster@nokia.com X-Trace: news1.nokia.com 1147184653 172.26.210.110 (Tue, 09 May 2006 17:24:13 EET DST) NNTP-Posting-Date: Tue, 09 May 2006 17:24:13 EET DST Xref: g2news2.google.com comp.lang.ada:4153 Date: 2006-05-09T14:24:13+00:00 List-Id: Brenta wrote: >> with Discrim; use Discrim; >> procedure Use_Discrim is >> A : Type_A_Ptr; -- public implementation >> B : Type_B_Ptr; -- private implementation >> begin >> A := new Type_A'(Param => 100); -- qualified expression >> B := new Type_B (Param => 123); -- type conversion >> end Use_Discrim; >> >> So, my question to the experts is: Why does "privatising" a type's >> details change the way that you "new" instantiations of it? > > Actually, the declaration of B is not a type conversion; it is an > allocator that uses a subtype_mark, as opposed to a > qualified_expression (see ARM 4.8(2)). Thanks, Ludovic - especially for the ARM references. I now understand that the expression for B was not a type conversion - though to a novice it resembles one : a subtype_mark followed by something in brackets! You say that B is an allocator with a subtype_mark - but ARM 3.2.2 suggests to me (probably wrong!) that it's a subtype_indication, because it has a constraint (the discriminant). -- Rick