pattis@cs.washington.edu (Richard Pattis) (12/15/89)
Is there a good reason why the reserved word NULL is both a legal statement and value (apart from the reason that Ada saves one reserved word by using this one for double duty)? From a teacher's persepective, after going out of my way to differentiate expressions from statements (students often try to write function calls as statements, assuming Ada implicitly does the right thing with the returned value), I choke a bit when having to explain NULL the expression interpretation of NULL. A common NULL mistake that I see (which is difficult to debug) is students writing functions (often recursive) that return access objects. They write ..... IF ... -- base case THEN NULL; -- the answer is NULL ELSE ..... RETURN .... END IF; ..... Of course, they have omitted RETURN in the THEN clause, but the result is still a statically legal Ada function. By using NULL and NIL (for example) this problem could be recognized as an error by the compiler. Are there other compelling reasons for using NULL to mean both? Rich Pattis