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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,c1131ea1fcd630a X-Google-Attributes: gid103376,public From: bobduff@world.std.com (Robert A Duff) Subject: Re: To Initialise or not Date: 1996/05/01 Message-ID: #1/1 X-Deja-AN: 152410287 references: <318508FE.204B@sanders.lockheed.com> <3185E379.7C20@lmtas.lmco.com> organization: The World Public Access UNIX, Brookline, MA newsgroups: comp.lang.ada Date: 1996-05-01T00:00:00+00:00 List-Id: In article , Keith Thompson wrote: >The real problem, I think, is that the access value null plays two >different roles: as an uninitialized (garbage) value, and as a legitimate >access value that doesn't designate any object. Exactly. >... If I were designing a >new language, I'd be tempted to define a second distinguished access >value called, say, "invalid". The value null would act like it does >in Ada: it doesn't point to anything and an attempt to dereference it >raises Constraint_Error. The value invalid would be the default initial >value of all access types; an attempt to dereference it *or to reference >it* would raise Constraint_Error. Why restrict it to access values? As I said in another post, an integer array index is a pointer, just like an access value, and allowing totally undefined array index values can do just as much damage as allowing undefined access values. While we're talking about language design: I think the idea of always having a single "special" value, and always calling it "null" is ugly. Some access types shouldn't *have* a null value at all. (E.g. consider a circular linked list, with a dummy header element. The links can *never* be null, unless there's a bug.) And when I *do* need an extra "special" value, why is it always called "null"? In one case, it ought to be called "End_Of_List". In another case it should be called "Not_Yet_Determined" or something. And why can't I have *two* of the special things? - Bob