Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site spuxll.UUCP Path: utzoo!watmath!clyde!bonnie!akgua!whuxlm!spuxll!ech From: ech@spuxll.UUCP (Ned Horvath) Newsgroups: net.lang Subject: Re: levelheight: automatic "nil pointer" handling Message-ID: <618@spuxll.UUCP> Date: Mon, 4-Feb-85 10:52:48 EST Article-I.D.: spuxll.618 Posted: Mon Feb 4 10:52:48 1985 Date-Received: Wed, 6-Feb-85 01:33:06 EST References: <6304@boring.UUCP> Organization: AT&T Information Systems, South Plainfield NJ Lines: 27 Your example of "static checks" of nil dereferencing make, rather than refute, the argument that nil-dereferencing cannot be checked for statically. What you have accomplished is to enforce the convention that any potentially nil-valued pointer must be explicitly AND DYNAMICALLY checked for a nil-value prior to dereferencing it. This reduces to the same thing; what difference does it make if the compiler forces the programmer to insert nil-checking code, or does it automatically? Either way, the check MUST be done dynamically, and that is all the reductio ad absurdum (via TM halting) was meant to show. Strong typing is not at all the same thing; it is possible to rewrite your example so that 'insert' and 'print' take only non-empty trees as arguments, for example. If we did that without modifying the main program, that would correctly generate a compiler (or linker) exception due to type mis-match. Static checking for a type mismatch is eminently feasible. To summarize: static analysis suffices to determine WHERE TO PUT code to check for things like nil values and array-index-out-of-bounds, but the checks themselves MUST, in general, be made at run time. There really isn't anything to argue about here: can a compiler recognize (and enforce or generate protection against) potentially inconvenient run-time conditions? Sure, no argument. Is it in the nature of some of those conditions that they MUST be checked for at run time? I think we have established that as well. =Ned=