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: a07f3367d7,4ce5890331a5b529 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!news.glorb.com!news.mv.net!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: Discriminants of tagged types Date: Wed, 27 Oct 2010 12:06:52 -0400 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: <14314714-e92c-4036-9cbb-da8e72489261@h7g2000yqn.googlegroups.com> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: pcls6.std.com 1288195596 1271 192.74.137.71 (27 Oct 2010 16:06:36 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Wed, 27 Oct 2010 16:06:36 +0000 (UTC) User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.3 (irix) Cancel-Lock: sha1:YIQhI1gTWMO8pfqvL2OsaDsrPeY= Xref: g2news1.google.com comp.lang.ada:14844 Date: 2010-10-27T12:06:52-04:00 List-Id: Maciej Sobczak writes: > In the mean time I have solved the problem by realizing that > "taggedness" need not be public - in my case the type was tagged, > because it was controlled (hate to repeat it, but the interaction > between these two unrelated language features is really annoying). > I don't have to expose the controlled nature of the type in the public > view and moved the "tagged" keyword to private part. > Interestingly, this allowed me to use default values for discriminants > *and* have the controlled type. That doesn't sound right. What does your example look like, and what compiler compiled it without error? The latest GNAT says: 1. with Ada.Finalization; use Ada.Finalization; 2. package Eg is 3. type T (X: Boolean := False) is private; 4. private 5. type T (X: Boolean := False) is new Controlled with null record; | >>> discriminants of tagged type cannot have defaults 6. end Eg; 6 lines: 1 error > (and this also shows that your explanation for why it cannot work is > shaky ;-) ) Well, it would if it were true. ;-) > (except that now the "distinguished receiver" notation is gone...) I'm not a big fan of that notation. An awful lot of compiler work for a little bit of syntactic sugar (or maybe syntactic salt). - Bob