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=-0.8 required=5.0 tests=BAYES_00,INVALID_DATE autolearn=no autolearn_force=no version=3.4.4 Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!shadooby!samsung!cs.utexas.edu!rice!uw-beaver!uw-june!pattis From: pattis@cs.washington.edu (Richard Pattis) Newsgroups: comp.lang.ada Subject: NULL statements, NULL values, and teaching Summary: statement/expression/grief Message-ID: <10188@june.cs.washington.edu> Date: 14 Dec 89 20:09:57 GMT Organization: U of Washington, Computer Science, Seattle List-Id: 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