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,a575249b5f286bfe X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.233.170 with SMTP id tx10mr757156pbc.0.1334867168731; Thu, 19 Apr 2012 13:26:08 -0700 (PDT) MIME-Version: 1.0 Path: r9ni75434pbh.0!nntp.google.com!news2.google.com!news4.google.com!fu-berlin.de!nuzba.szn.dk!news.jacob-sparre.dk!munin.jacob-sparre.dk!pnx.dk!.POSTED!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Garbage Collection ??? Date: Thu, 19 Apr 2012 15:26:03 -0500 Organization: Jacob Sparre Andersen Research & Innovation Message-ID: References: <4f881910$0$2652$703f8584@news.kpn.nl> <5o86o2smbjpz.17l849bmku28v$.dlg@40tude.net> <4f888010$0$2641$703f8584@news.kpn.nl> <4f88ed79$0$2660$703f8584@news.kpn.nl> <6997433.1158.1334740025722.JavaMail.geo-discussion-forums@ynmm10> NNTP-Posting-Host: static-69-95-181-76.mad.choiceone.net X-Trace: munin.nbi.dk 1334867167 31303 69.95.181.76 (19 Apr 2012 20:26:07 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Thu, 19 Apr 2012 20:26:07 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 Date: 2012-04-19T15:26:03-05:00 List-Id: "Robert A Duff" wrote in message news:wcc4nsf4wm4.fsf@shell01.TheWorld.com... > Julian Leyh writes: > >> Am Samstag, 14. April 2012 20:21:17 UTC+2 schrieb Robert A Duff: >>> In Ada 2012, you can say: >>> >>> type T_Ptr_Opt is access all T; >>> subtype T_Ptr is T_Ptr_Opt with >>> Dynamic_Predicate => T_Ptr /= null; >> >> In Ada 2005, you can already say: >> >> type T_Ptr_Opt is access all T; >> subtype T_Ptr is not null T_Ptr_Opt; > > Right, but that's less useful, because it forces you > to initialize your variables (e.g. record components) > before you're ready to. I don't think that's really true, since the rule that you're referring to applies if *any* components are initialized. So while it is true (but a bad idea for access types, IMHO) for stand-alone objects, depending on it is iffy at best in records. In all honesty, I think the rule that makes these work different is just a bug in Ada 2012. The rule *I* was thinking about only applied to things that aren't initialized at all (i.e. scalars), not to things that are initialized automatically (access types and Default_Value aspects). In the latter case, you can use the object immediately and *never* initialize it -- having the predicate not enforced means that it cannot ever be trusted on such objects. That seems like a bad way to go (and different from constraints). Thus, I think the current rule (3.2.4(31/3)) is OK for composite types, but it is wrong for elementary types when those are automatically initialized. (And a null-excluding component - by any means - is almost never a good idea. You always need a "nothing/unknown" indicator. Null-exclusions are almost exclusively useful for parameters, where you don't need "nothing" simply because you don't make the call in that case.) Randy.