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=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!nntp-feed.chiark.greenend.org.uk!ewrotcd!newsfeed.xs3.de!io.xs3.de!news.jacob-sparre.dk!franka.jacob-sparre.dk!pnx.dk!.POSTED.rrsoftware.com!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: two questions on allocators Date: Wed, 28 Feb 2018 17:37:57 -0600 Organization: JSA Research & Innovation Message-ID: References: <93229821-ae3d-4e47-91d9-a20ff3c1f1a7@googlegroups.com><55fda761-55f8-4b25-b8ab-0125acf16b05@googlegroups.com> Injection-Date: Wed, 28 Feb 2018 23:37:58 -0000 (UTC) Injection-Info: franka.jacob-sparre.dk; posting-host="rrsoftware.com:24.196.82.226"; logging-data="20485"; mail-complaints-to="news@jacob-sparre.dk" 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.7246 Xref: reader02.eternal-september.org comp.lang.ada:50727 Date: 2018-02-28T17:37:57-06:00 List-Id: "Robert A Duff" wrote in message news:wcczi3t6qqh.fsf@TheWorld.com... > Mehdi Saada <00120260a@gmail.com> writes: > >> I saw that since I (tried to) read the AARM, but didn't really got >> it. Now it's ok. If the problem of these null forbidding hypothetic >> subtypes is that can't have the default null value, why not just require >> the user to give one ? > > Don't use "not null"; it's broken as you see. Instead, do: > > subtype S is T with Predicate => S /= null; ??? You'd get the same problem with the allocators (that they always raise an exception) with this formulation. If you did want a subtype to use for an initialized allocator (which the OP specifically wasn't using), then subtype S is not null T; works just fine. And this at least is guaranteed to be checked everywhere necessary, that's not true for a Dynamic_Predicate (as you know). Probably in most cases, they are equivalent, but when they are not equivalent, it is just because you have pushed static checks to runtime, which hardly seems to be an advantage. Randy.