Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 (Tek) 9/28/84 based on 9/17/84; site tekchips.UUCP Path: utzoo!watmath!clyde!burl!ulysses!mhuxr!mhuxt!houxm!vax135!cornell!uw-beaver!tektronix!tekcrl!tekchips!toma From: toma@tekchips.UUCP (Tom Almy) Newsgroups: net.micro,net.micro.pc,net.lang.c,net.lang.pascal,net.lang.forth Subject: Re: FORTH, PASCAL, and C--- which one would you choose (it depends ?) Message-ID: <441@tekchips.UUCP> Date: Thu, 2-Jan-86 12:15:48 EST Article-I.D.: tekchips.441 Posted: Thu Jan 2 12:15:48 1986 Date-Received: Sat, 4-Jan-86 00:21:27 EST References: <1191@princeton.UUCP> Reply-To: toma@tekchips.UUCP (Tom Almy) Distribution: net Organization: Tektronix, Beaverton OR Lines: 76 Xref: watmath net.micro:13356 net.micro.pc:6398 net.lang.c:7490 net.lang.pascal:418 net.lang.forth:334 Summary: Pro-Forth, but uses them all and BASIC In article <1191@princeton.UUCP> wei@princeton.UUCP (P Wei) writes: >I compared the Eratosthenes sieve benchmark for Lattice C, Microsoft C, >TURBO Pascal and HS/Forth for IBMPC. For 10 iterations, the execution looks >like : [ various timings ] > >Now, the question is : >It seems that Forth is as extensible and structured as C and Pascal (to my >understanding), and generates more compact and faster execution program. >Its interpreter being far more faster than BASIC's makes developement time of a >project much less than when using 'edit-compile-link-test' type of language. >I wonder why Forth is still less popular (to my impression) than C and Pascal. Well ignorance (and I mean to offend nobody by this) is a problem. Most programmers don't KNOW Forth, and so cannot judge it. "C" is popular amoung UNIX users, because you just about have to use C under UNIX (I have had no good experiences with it in NON-UNIX systems). PASCAL is taught in schools so it has a guarenteed user community -- its rigidity is favored by academic types. I used it for programs heavily into data structures, but only for those that PASCAL supports. There are millions of potential Microsoft BASIC users, since it is built into almost everyone's personal computer. I use Microsoft BASIC when I want to manipulate strings. On the other hand, FORTH takes effort -- you have to go out of your way to obtain it, and you have to learn it on your own. >Is it because : >--its somewhat 'awkward' syntax ? (Pascal is closer to human language) Pascal closer to human language? GAG! If you want to program in human language use COBOL :-). Actually Forth has simpler syntax rules than any other language I know except for un-adulterated LISP; I can explain the syntax rules of Forth much faster than I could appologise for the semicolon rules in PASCAL! >--its lack of predefined data structure ? This is certainly a disadvantage to learning Forth, but the ability to create any data structure you want and placing them anywhere you please (like an array on a remote system accessed via modem), hiding the access method like in Smalltalk, is very powerful indeed. >--its putting great responsibilty on the programmer ? (the kernel is so compact > and simple that you must first extend the system and create many things which > in C and Pascal are taken care of by the compiler-writer.) In this sense, > if I compare the simplicity and primitiveness I get: > Assembly > Forth > C > Pascal (where > means simpler than). But the extensibility of Forth allows making it "less simple" as applications require. If you MUST have infix expressions, you can have them; if you want bounds checking on arrays, or or traps on arithmetic overflow, you can have that too (and be just as invisible to the programmer as in PASCAL). > We know power comes from simplicity, however we must pay price for it. > [...] >For Forth-lovers, do you think Forth is suitable for being used as a >general purpose language instead of the one 'exclusively' designed >for use in the lab and industry to control the machine... Yes, in fact I have seen accounting packages in Forth, and scientific programs in Forth. In the past year I have been rewriting many of my favorite CP/M and MSDOS utilities (mostly filter like programs) in Forth using the Forth compiler I have written, getting typically 2-4x speedups (4x for AZTEC CP/M programs that used "stdio"), and 75% code size reductions. I have implemented a multi-tasking multi-user Forth in CP/M (three users and a printer spooler on a Z-80!). I also have written an IC layout program in Forth. I have used it in "traditional" Forth environments as well. >Note: I am not a dedicated C, Pascal or Forth programmer. >HP Wei (wei@princeton) At different points in time, I used almost exclusively all of these, as well as Fortran, BCPL, LISP and APL. Now I am using Forth almost exclusively. Tom Almy (Usual disclaimer, but you can flame directly at me if you want. Why wear out /dev/null?).