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.1 required=5.0 tests=BAYES_00, PP_MIME_FAKE_ASCII_TEXT autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,86dfd999acf13c9d X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII X-Received: by 10.66.231.41 with SMTP id td9mr4768763pac.35.1367623024090; Fri, 03 May 2013 16:17:04 -0700 (PDT) MIME-Version: 1.0 Path: bp1ni1481pbd.1!nntp.google.com!news.glorb.com!feeder.erje.net!eu.feeder.erje.net!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: Allocators and the requirement to raise `Storage_Error` Date: Fri, 3 May 2013 18:17:02 -0500 Organization: Jacob Sparre Andersen Research & Innovation Message-ID: References: <0cd370b8-d798-4080-b346-00b1527362e8@googlegroups.com> NNTP-Posting-Host: static-69-95-181-76.mad.choiceone.net X-Trace: munin.nbi.dk 1367623023 20508 69.95.181.76 (3 May 2013 23:17:03 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Fri, 3 May 2013 23:17:03 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Response X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 Date: 2013-05-03T18:17:02-05:00 List-Id: "Yannick Duch�ne (Hibou57)" wrote in message news:op.wwh16wl5ule2fv@cardamome... ... >I still wonder why there is no provision for an allocator to return `null` >instead of raising an exception, when a custom function of a constrained >subtype/type, which would provide the same functionality, does not get >imposed this obligation. This seems like a bizarre question. Ada doesn't allow returning the wrong answer from an operation; it's required to return the right answer or an exception. The operation "new" returns an allocated object. Period. If that can't be done, then an exception is raised immediately. Not doing this would hide storage exhaustion and would make it look like an ordinary bug. That would make it a lot harder to reason about programs (its very hard to reason about storage exhaustion, it formally can happen anywhere, even "null;"). Keeping them separate helps both debugging and formal tools. Randy.