Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!wuarchive!uunet!visix!ip2020!adamksh From: adam@visix.com Newsgroups: comp.lang.forth Subject: Re: Forth in CS Message-ID: <1991Mar7.193258.2069@visix.com> Date: 7 Mar 91 19:32:58 GMT References: <9103061356.AA26910@ucbvax.Berkeley.EDU> Sender: news@visix.com Reply-To: adam@visix.com Organization: Visix Software Inc., Reston, VA Lines: 82 Okay, I guess I should explain myself more carefully. I stated that structured programming considered GOTO's evil, primarily because I wanted to use that example for an analogy. I won't argue about whether GOTO's have legitimate uses. I won't argue about whether the definition of structured programming necessarily considers GOTO's evil. I know that not all control structures are loops; e.g. CLU and Ada have exception handling. I used loops as a common example. I only concluded recently that "control structures suck," so I am not prepared to demonstrate equivalents for every existing control structure, and so I wrote "used primarily", and "I suspect." I do not think all theorists forget to ask the right questions. I do not think my questions are the ones theorists have to ask; I do not think that theorists are doing the wrong thing. > Theorists follow their interests, often without considering > applications (nor should they). ^^^ ^^^^^^ ^^^^ I do think that techniques like parsing, which may be very well understood theoretically, are not necessarily the best way to improve my productivity as a programmer (unless I do Natural Language). > Ok, let's reinvent the weel (your arguments were used sometime ago... 196X). I don't understand the purpose of this comment. Are you claiming that people already program in the style I suggest? I don't find this in the code I have seen, except for APL, some (repeat: some) Lisp programs, and UNIX one-line command scripts. I wouldn't claim to have invented this wheel; APL, Lisp, and UNIX are examples. I should also say that my train of thought was started by the "Minimizing Control Structures" chapter of Thinking Forth. But wheels that have been invented still need to be used. I also can't tell what you mean about my arguments being used back in 196X. I'm not even sure if you might have misunderstood my argument. References would help. > I didn't understand the last. (UNIX) Briefly, UNIX's pipe operator allows you to construct surprisingly sophisticated one-line command sequences, without conditionals. Please don't ask me to explain in detail; any good UNIX book will do. > Anyway, for the first two: Think Functional > Paradigm! And Think OOP because there you have this too... Functional programming is about evaluation and avoiding side-effects. These are separate issues from how often the keyword "IF" appears in your program. And, Goldberg and Robson's _Smalltalk-80_ contains neither use nor mention of the programming style I suggest. > No IF's? How can you do that? LISP can't... APL have IFs too. : : > Iteratio is a control structure, if you don't know. Control structures makes >the program do things in a non-sequencial way. Calling procedures is a control > structure, repeat many times is a control structure, and it doesn't matter if > your LOOP is hidden or not. You HAVE to specify an iterator, don't you? I just realized what I should have said in the first place. Every line should be a basic block. A basic block has one entry point and one exit point. In languages like C, since a function is the unit of decomposition, it is only required that functions be basic blocks. Since Forth encourages a finer decomposition, it suggests that we can make basic blocks smaller. Smaller basic blocks also provides enormous benefits for traditional compilers; smaller basic blocks makes programs easier to reason about, and therefore easier to optimize, and also easier to parallelize. Adam