Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site princeton.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!princeton!wei From: wei@princeton.UUCP (P Wei) Newsgroups: net.micro,net.micro.pc,net.lang.c,net.lang.pascal,net.lang.forth Subject: FORTH, PASCAL, and C--- which one would you choose (it depends ?) Message-ID: <1191@princeton.UUCP> Date: Sun, 29-Dec-85 23:54:26 EST Article-I.D.: princeto.1191 Posted: Sun Dec 29 23:54:26 1985 Date-Received: Mon, 30-Dec-85 04:54:50 EST Distribution: net Organization: Princeton University EECS Dept Lines: 38 Xref: watmath net.micro:13315 net.micro.pc:6368 net.lang.c:7473 net.lang.pascal:412 net.lang.forth:328 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 : Microsoft C : 13.2 sec (from pc-tech Jan 1986, p91) 8.1 sec (using register) Lattice C : 10.5 sec (from the same place as above) TURBO Pascal: 14.1 sec (from an ad for ZBASIC) HS/Forth : 47.0 sec in interpreter (data from ad) 7.0 sec using code optimizer and improved program Assembler : 5.0 sec 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. Is it because : --its somewhat 'awkward' syntax ? (Pascal is closer to human language) --its lack of predefined data structure ? --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). We know power comes from simplicity, however we must pay price for it. For C-lovers, do you think UNIX-like (or operating system in the general sense) can be written in FORTH and possibly has better performance? For Pascal-lovers, is the 'visually' readability and strongly type the primary advantage ? and a must ? 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... Note: I am not a dedicated C, Pascal or Forth programmer. HP Wei (wei@princeton)