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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,839916f6ca3b6404 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!feeder.news-service.com!newsfeed-fusi2.netcologne.de!195.14.215.230.MISMATCH!news.netcologne.de!newsfeed-hp2.netcologne.de!newsfeed.arcor.de!newsspool1.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: not null Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <49ae93bc$0$31872$9b4e6d93@newsspool3.arcor-online.net> <761a4fb8-de91-43b3-b420-55dbc06a61e7@k9g2000prh.googlegroups.com> Date: Thu, 5 Mar 2009 09:42:46 +0100 Message-ID: <1pji2yyih0ot4$.1kjzwo0k6285p$.dlg@40tude.net> NNTP-Posting-Date: 05 Mar 2009 09:42:37 CET NNTP-Posting-Host: 6de65bf8.newsspool1.arcor-online.net X-Trace: DXC=@;0afcAIGnJgj[ZPFj7ehOic==]BZ:afN4Fo<]lROoRA^YC2XCjHcbIXofUeHBj;mJDNcfSJ;bb[EFCTGGVUmh?DLK[5LiR>kgBb;i]795RNhK X-Complaints-To: usenet-abuse@arcor.de Xref: g2news1.google.com comp.lang.ada:3962 Date: 2009-03-05T09:42:37+01:00 List-Id: On Wed, 4 Mar 2009 17:54:16 -0800 (PST), Adam Beneschan wrote: > On Mar 4, 12:38 pm, "Dmitry A. Kazakov" > wrote: > >> Recursive types is not the single case where references are used. For smart >> pointers not null constraint is very useful. > > Right, I didn't say a "not null" constraint isn't useful; I'm just > saying that it's also useful to have access objects that *can* be > null, if needed. Actually, I'm not clear on whether anyone disagrees > with that. This points to a curiosity in Hoare's abstract: first he > implies that inventing "null references" was a big mistake, and then > he says "declarations for non-null references" is the solution. If > allowing null references is a mistake, then the solution is to > disallow them---not to allow the programmer to declare a reference > that may not be null, right? Right, this is what smart pointers use, not a constraint in the sense of an Ada subtype, but a type that does not have null as a value. A smart pointer is always valid. > I think maybe Hoare misstated the > problem. The mistake wasn't inventing null references; the mistake > was not providing a way for the programmer to disallow selected > reference types or variables (objects) from being null. This > misstatement may have led to some confusion on this thread. Yes, there are two cases: dynamically constrained references and statically constrained ones. Both have their uses. Concerning the invention of null, I can understand Hoare's point. There is a comparable case with IEEE 754, where ideal values like NaN were invented. Sometimes this adds a lot of pain, which could be spared. Sometimes it does not. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de