Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site watdaisy.UUCP Path: utzoo!watmath!watdaisy!ndiamond From: ndiamond@watdaisy.UUCP (Norman Diamond) Newsgroups: net.lang Subject: Re: levelheight: automatic "nil pointer" handling Message-ID: <6881@watdaisy.UUCP> Date: Fri, 25-Jan-85 10:04:48 EST Article-I.D.: watdaisy.6881 Posted: Fri Jan 25 10:04:48 1985 Date-Received: Sat, 26-Jan-85 04:49:59 EST References: <2340@hplabsc.UUCP> <4948@utzoo.UUCP> <6292@boring.UUCP> <536@mako.UUCP> Distribution: net Organization: U of Waterloo, Ontario Lines: 42 > > For instance, it is possible to statically guarantee that nil pointers are > > never dereferenced (imagine the bugs that that would prevent!) but I know of > > no language that supports it. > > Ada supports this: [quoted from Booch] > > |Not only can we explicitly create objects designated by access values, but we > |can also destroy them. Such objects will no longer be accessible if all > |references to them are removed, such as: > | > | MY_PACKET := new BUFFER; -- a BUFFER object is created > | MY_PACKET := null; -- the original object is unreachable > | > |Furthermore, these dynamic objects will be destroyed once we leave the scope > |of the access objects. For example: > | > | declare > | POINTER : BUFFER_POINTER; > | begin > | ... > | POINTER := new BUFFER; -- create a BUFFER object > | ... > | end; -- BUFFER object is destroyed The "answer" has nothing to do with the problem. Of course objects that are no longer referenced can be de-allocated. Furthermore, it is done dynamically. The first netter's suggested problem was to diagnose programs that dereference nil pointers. This too can be done dynamically. He suggested that it can be done statically. I find that very hard to believe. Can a compiler do static checking and generate code to de-allocate objects, as in the second netter's quotation? I find that very hard to believe, too. Aside from this disbelief, the two issues have little in common. -- Norman Diamond UUCP: {decvax|utzoo|ihnp4|allegra|clyde}!watmath!watdaisy!ndiamond CSNET: ndiamond%watdaisy@waterloo.csnet ARPA: ndiamond%watdaisy%waterloo.csnet@csnet-relay.arpa "Opinions are those of the keyboard, and do not reflect on me or higher-ups."