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,839916f6ca3b6404 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!k9g2000prh.googlegroups.com!not-for-mail From: Adam Beneschan Newsgroups: comp.lang.ada Subject: Re: not null Date: Wed, 4 Mar 2009 08:09:56 -0800 (PST) Organization: http://groups.google.com Message-ID: <761a4fb8-de91-43b3-b420-55dbc06a61e7@k9g2000prh.googlegroups.com> References: <49ae93bc$0$31872$9b4e6d93@newsspool3.arcor-online.net> NNTP-Posting-Host: 66.126.103.122 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: posting.google.com 1236182996 17515 127.0.0.1 (4 Mar 2009 16:09:56 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Wed, 4 Mar 2009 16:09:56 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: k9g2000prh.googlegroups.com; posting-host=66.126.103.122; posting-account=duW0ogkAAABjRdnxgLGXDfna0Gc6XqmQ User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.7.12) Gecko/20050922 Fedora/1.7.12-1.3.1,gzip(gfe),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:3938 Date: 2009-03-04T08:09:56-08:00 List-Id: On Mar 4, 6:56 am, Hyman Rosen wrote: > Georg Bauhaus wrote: > > As said to have been seen on /. > > another financial disaster, again caused > > by making references to nothing, in Algol W, > >http://qconlondon.com/london-2009/presentation/Null+References:+The+B... > > You are misreading the abstract. First of all, it's not > about some particular incident. He's talking about the > overall impact. Second, he's not talking about failure > to check for null references, he's talking about having > null references at all, so Ada is no better. I'm having difficulty understanding the point. You have to have the idea of the lack of a reference. How else would you implement a linked list abstraction? The first element has a reference to the second, and the second has a reference to the third, but the last one won't have a reference to anything. This lack of a reference has to be represented somehow, right? Suppose that access values in Ada were not allowed to have null values, and (for a linked list) you needed the concept of a value that may or may not refer to another object. You could write this as a variant record: type Obj_Reference (Present : Boolean) is record case Present is when True => Ref : Obj_Access; -- may not be null when False => null; end case; end record; I just don't see how this is an improvement; it simply shifts the problem. Whatever mistakes a programmer could in the actual Ada language make by forgetting to check whether an access value is null, he could make in the above example by forgetting to check the Present discriminant. And I suspect the same is true of any other "solution" to the necessary concept of an "optional" reference that may refer to an object or not; the set of mistakes you could make with that solution is the same (if not greater) than the set you could make with an access value that can be null---it's only that the syntax of those mistakes would be different. -- Adam