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!news3.google.com!news2.google.com!newsfeed2.dallas1.level3.net!news.level3.com!bloom-beacon.mit.edu!newsswitch.lcs.mit.edu!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 09:44:17 -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 1288187037 19668 192.74.137.71 (27 Oct 2010 13:43:57 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Wed, 27 Oct 2010 13:43:57 +0000 (UTC) User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.3 (irix) Cancel-Lock: sha1:Oq2h+PWXSdG105l2+3sYcCCPj6o= Xref: g2news1.google.com comp.lang.ada:14829 Date: 2010-10-27T09:44:17-04:00 List-Id: Maciej Sobczak writes: > GNAT says that discriminants of tagged types cannot have default > values. Well, Ada says that. GNAT is just following orders. ;-) > but this is an error: > > type T (A : Integer := 0) is tagged null record; We tried very hard during Ada 9X to allow this, but we kept running into semantic difficulties, which required more and more complicated rules to fix. One day, Tucker said to me (or I said to Tucker -- I don't remember which), let's just outlaw this. We both agreed it was a big simplification. Sorry, I don't remember in detail what the semantic difficulties were. Ludovic's explanation seems as good as any. I believe Ada 2012 will allow defaults for LIMITED tagged types, and I think (not sure) it's already implemented in GNAT under -gnat2012 mode. The limited case is easy, because the weird rule that says "defaulted discriminants can change" isn't true for limited types, because assignment statements are forbidden. - Bob