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,FREEMAIL_FROM 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 Path: g2news1.google.com!postnews.google.com!33g2000yqm.googlegroups.com!not-for-mail From: =?ISO-8859-1?Q?Hibou57_=28Yannick_Duch=EAne=29?= Newsgroups: comp.lang.ada Subject: Re: not null Date: Thu, 5 Mar 2009 17:04:18 -0800 (PST) Organization: http://groups.google.com Message-ID: <9f9a38dd-15a5-4395-a86d-c4c5e386a1bc@33g2000yqm.googlegroups.com> References: <49ae93bc$0$31872$9b4e6d93@newsspool3.arcor-online.net> <761a4fb8-de91-43b3-b420-55dbc06a61e7@k9g2000prh.googlegroups.com> NNTP-Posting-Host: 79.91.74.149 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1236301458 12449 127.0.0.1 (6 Mar 2009 01:04:18 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 6 Mar 2009 01:04:18 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: 33g2000yqm.googlegroups.com; posting-host=79.91.74.149; posting-account=vrfdLAoAAAAauX_3XwyXEwXCWN3A1l8D User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; fr),gzip(gfe),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:3983 Date: 2009-03-05T17:04:18-08:00 List-Id: On 4 mar, 17:09, Adam Beneschan wrote: > I'm having difficulty understanding the point. =A0You have to have the > idea of the lack of a reference. =A0How else would you implement a > linked list abstraction? =A0The 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. =A0This lack of a reference has to > be represented somehow, right? =A0Suppose 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: > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 -- Adam I use to think about it a long time ago and was thinking that the best null or nil reference to an object would be a reference to a null or nil object (a special singleton object). I do not mean an object which will stand for all null references, rather an object for each type. An other view : a null reference is a kind of boolean (it used this way and cannot be used another way).... and with hindsight, this may perhaps look funny. This boolean is a kind of constraint on a kind of record with a discriminent (conceptually). Just to talk about lists, this may be a circular list, with a flag on the last element telling it is has a special meaning.