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=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,4ce5890331a5b529 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,UTF8 Path: g2news1.google.com!postnews.google.com!u17g2000yqi.googlegroups.com!not-for-mail From: Maciej Sobczak Newsgroups: comp.lang.ada Subject: Re: Discriminants of tagged types Date: Wed, 27 Oct 2010 14:05:32 -0700 (PDT) Organization: http://groups.google.com Message-ID: <989c6412-8dbf-403c-9ce0-766e0e953fb6@u17g2000yqi.googlegroups.com> References: <14314714-e92c-4036-9cbb-da8e72489261@h7g2000yqn.googlegroups.com> NNTP-Posting-Host: 85.1.243.81 Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1288213532 30799 127.0.0.1 (27 Oct 2010 21:05:32 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Wed, 27 Oct 2010 21:05:32 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: u17g2000yqi.googlegroups.com; posting-host=85.1.243.81; posting-account=bMuEOQoAAACUUr_ghL3RBIi5neBZ5w_S User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8,gzip(gfe) Xref: g2news1.google.com comp.lang.ada:14862 Date: 2010-10-27T14:05:32-07:00 List-Id: On 27 Pa=C5=BA, 18:06, Robert A Duff wrote: > > In the mean time I have solved the problem by realizing that > > "taggedness" need not be public > That doesn't sound right. I was surprised, too. >=C2=A0What does your example look like, Much more complex, but reproducible with your code. > and what compiler compiled it without error? GPL 2009 (20090519) > The latest GNAT says: > > =C2=A0 =C2=A0 =C2=A01. with Ada.Finalization; use Ada.Finalization; > =C2=A0 =C2=A0 =C2=A02. package Eg is > =C2=A0 =C2=A0 =C2=A03. =C2=A0 =C2=A0type T (X: Boolean :=3D False) is pri= vate; > =C2=A0 =C2=A0 =C2=A04. private > =C2=A0 =C2=A0 =C2=A05. =C2=A0 =C2=A0type T (X: Boolean :=3D False) is new= Controlled with null > =C2=A0 =C2=A0 =C2=A0record; > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0| > =C2=A0 =C2=A0 =C2=A0 =C2=A0 >>> discriminants of tagged type cannot have = defaults > > =C2=A0 =C2=A0 =C2=A06. end Eg; My compiler eats this stuff without even blinking. It complains only when I add the "tagged" keyword in line 3, between "is" and "private". > > (except that now the "distinguished receiver" notation is gone...) > > I'm not a big fan of that notation. =C2=A0An awful lot of compiler > work for a little bit of syntactic sugar (or maybe syntactic > salt). Protected objects, tasks and records already supported it. It is not a new idea, so it wasn't that big deal for compiler writers, I guess. I treat it as a unification of syntax across these similar features - quite a valid goal in language design. This is especially reasonable if you take into account that in Ada 2005 protected types can derive from interfaces. It would be very inconsistent not to allow the same calling syntax across the whole hierarchy, including the class-wide type. type Base is interface; procedure Do_Something (X : in out Base) is abstract; protected type Derived is new Base with procedure Do_Something; end Derived; D : Derived; B : Base'Class :=3D D; D.Do_Something; -- this was always OK, D is protected B.Do_Something; -- this *should* be OK as well for consistency -- Maciej Sobczak * http://www.inspirel.com