Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!dali.cs.montana.edu!uakari.primate.wisc.edu!zaphod.mps.ohio-state.edu!mips!pacbell.com!ucsd!mvb.saic.com!unogate!unocal!genisco!arcturus!felix!ka@felix.UUCP From: ka@felix.UUCP (Kenneth Almquist) Newsgroups: comp.lang.icon Subject: Re: Algol->Icon & Pascal Message-ID: <163508@felix.UUCP> Date: 23 May 91 00:31:56 GMT References: <1991May14.222651.16502@midway.uchicago.edu> Sender: daemon@felix.UUCP Organization: FileNet Corp., Costa Mesa, CA Lines: 32 goer@ellis.uchicago.edu (Richard L. Goerwitz) writes: > I've always wondered why Icon uses the brace notation (rather than > begin ... end;) for most groupings, but yet for procedures, a kind > of mixed procedure name(vars)...end notation is used. My guess is that this produces better diagnostics when braces are omitted. If you omit an open brace in C, the compiler will eventually encounter a closing brace in the middle of the procedure which appears to match the start of the procedure. None of the C compilers that I have seen are capable of recognizing this situation and determining that the procedure hasn't actually ended. Instead, they treat the procedure as ended and squawk about every line from the closing brace until the actual end of the procedure. Using something other than a closing brace to mark the end of a procedure avoids this problem. > I'm also a bit curious why the notion of functions and procedures > was collapsed into procedures, and yet with retention of the notion > that a procedure is a value (i.e. like what we normally associate > with functions). I'm not sure what you mean by a procedure being a value. Calling ICON procedures "functions" would be a mistake because the term "function" is defined by mathematicians to be something that returns exactly one value. In contrast, "procedure" is defined by usage within the compu- ter science community. In Algol and Pascal, a procedure can return values by setting parameters, but not by returning a value using the syntax for returning a value from a function. In PL/1 (which is more widely used than either Algol or Pascal) this restriction was lifted and a procedure can return a value using a "return" statement. So ICON's use of the term "procedure" to refer to something that can return zero or more values is a natural extension of prior practice. Kenneth Almquist