From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.5-pre1 Date: 15 Dec 92 18:08:21 GMT From: pattis@beaver.cs.washington.edu (Richard Pattis) Subject: Re: Language pitfalls (was Re: FORTRAN bug) Message-ID: <1992Dec15.180821.17817@beaver.cs.washington.edu> List-Id: Since Dave has volunteered to keep track.... When I introduce recursion in my CS1/CS2 class, this one never fails to show up. It is truly a C-like error (excuse the pejorative term) in that the distinction between a statement and value is clouded to reduce the number of reserved words. Often the base case of a recursive function to manipulate a list looks like: IF mumble = NULL THEN RETURN NULL; ELSE ... What my students sometimes write is IF mumble = NULL THEN NULL; ELSE ... Here the statement NULL replaces the returning of a NULL value (which might be better to denote as NIL, at the expense of another reserved word). Of course, this is all syntactically legal and the error shows up only at execution time: often as a PROGRAM_ERROR (so at least Ada catches it at some time) if there are no other statements after the IF in the function. Of course, some compilers will give a warning based on the functions data flow information. Rich Pattis -- ------------------------------------------------------------------------------ Richard E. Pattis "Programming languages are like Department of Computer Science pizzas - they come in only "too" and Engineering sizes: too big and too small."