Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!olivea!uunet!visix!ip2020!adamksh From: adam@visix.com Newsgroups: comp.lang.forth Subject: Re: Forth in CS Message-ID: <1991Mar4.211633.5080@visix.com> Date: 4 Mar 91 21:16:33 GMT References: <9103031944.AA02112@ucbvax.Berkeley.EDU> <1991Mar4.050505.27571@csi.uottawa.ca> Sender: news@visix.com Reply-To: adam@visix.com Organization: dis Lines: 84 In article <1991Mar4.050505.27571@csi.uottawa.ca>, cbbrowne@csi.uottawa.ca (Christopher Browne (055908)) writes: |> Unfortunately, the extensibility is not one of the topics that typical |> language theorists are interested in. Language design courses generally |> involve defining some sort of Pascal subset, and then writing a compiler |> for that subset. Computing theory is not happy with languages that are |> not constant in their definition... There may be a comment in A text, but |> Forth's "strong points" are NOT seen by language theorists as theoretically |> interesting. #define Incredibly-Arrogant-Tone-Slightly-Ameliorated-By-Humorous-Comment Quite frankly, I think typical language theorists are interested in the wrong things. |> What "new" control structures have been created in Forth? I'm not sure |> Forth has introduced ANY new control structures... I've recently concluded that control structures suck. They focus your attention on nitpicky little details of tests and switches instead of the higher level tasks you want to do. Structured programming states that GOTO's are evil because they are used to implement many different kinds of loops and branches. It is better to name the higher level constructs and use them directly. Why don't we take this reasoning further? What are loops used for? (1) Applying an action to all members of a set. (2) Sequencing similar actions. (3) Filtering a stream. These uses are focused around data types: set, sequence, stream. In (1), our iterations equal the size of the set, but we don't care about the execution order. In (2), we have a fixed set of actions for which order matters. In (3), we have an arbitrary length (perhaps infinite) sequence of actions. Why denote all of these with the same construct? Why not provide Sets, Sequences, and Streams, each with a corresponding "execute_over" operation? Think APL. Think Lisp. Think Unix. Similarly, conditionals and switches are used primarily to map sets of values to sets of actions. I suspect all control structures can be "hidden" this way. I suspect you could program in a style that uses control structures as rarely as structured programming uses GOTO. |> The people that spend their time writing about LALR(1) parseable languages |> don't want to KNOW about Forth... LALR parsing sucks. As Mitch Bradley pointed out, syntax sucks. (Okay, he was more polite.) Lisp manipulates programs easily because it doesn't have to translate the damn representation before and after every manipulation. All through my compilers course I was thinking "what a waste of time." This is not to say that I think Forth is a great language for theory. Forth is a practical language, not theoretical. But precisely for that reason, Forth hints at questions that theorists forget to ask. The theory of control structures is interesting, but what good is it? (Most control details should be abstracted away.) The theory of parsing is interesting, but what good is it? (If you want your programs to look like algebra or natural language, you have to parse them. But parsing costs power and efficiency.) Theorists follow their interests, often without considering applications (nor should they). Compiler theory is supposed to be all about productivity, but a compiler theorist is buried too deep to ask, "should I really be using a compiler?" When I'm trying to maximize my productivity, a lot of computer science looks like right answers to the wrong questions. Adam