Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site mit-eddie.UUCP Path: utzoo!watmath!clyde!burl!mgnetp!ihnp4!mit-eddie!nessus From: nessus@mit-eddie.UUCP (Doug Alan) Newsgroups: net.lang Subject: Gotos in programming languages Message-ID: <1979@mit-eddie.UUCP> Date: Wed, 6-Jun-84 00:53:10 EDT Article-I.D.: mit-eddi.1979 Posted: Wed Jun 6 00:53:10 1984 Date-Received: Fri, 1-Jun-84 08:26:34 EDT Organization: MIT, Cambridge, MA Lines: 33 Actually, gotos in a programming language (with labels) are winning as long as the language only allows one to goto in a forward direction. They're even better if the language provides for the passing of arguments to the goto destination. If you can only goto in a forward direction, then you can't get spaghetti. Both Lisp and CLU have these gotos. In Lisp, they are called "throw"s and in CLU they are called "exit"s. Both allow you to pass arguments. What do people think about tail recursion? For those who don't already know, tail recursion occurs when the interpreter or the compiler realizes that the result of calling a procedure is merely going to be be returned, and therefore it doesn't have to save any state on the stack for the current procedure. Thus one can recurse infinitely without ever getting a stack overflow. Both Scheme and Logo support this. A tail recursive procedure call is in effect a generalization of a goto (though it looks like a procedure call), because you never have to return from a tail recursive procedure call if you don't want to. It is a goto that allows the passing of arguments. Is this a good thing? Or should it be shunned like gotos? And for a final brash statement: If in an introductory programming course, you teach anything other than an object oriented programming language, such as Lisp, CLU, or Smalltalk (sorry folks, Pascal does not count), you are brain-damaging your students almost as much as if you taught them Basic. -- -Doug Alan mit-eddie!nessus Nessus@MIT-MC "What does 'I' mean"?