Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!tut.cis.ohio-state.edu!purdue!bouma From: bouma@cs.purdue.EDU (William J. Bouma) Newsgroups: comp.lang.forth Subject: Re: Forth in C (was Re: Forth from scratch) Message-ID: <8637@medusa.cs.purdue.edu> Date: 14 Nov 89 19:34:53 GMT References: <4839@sdcc6.ucsd.edu> <2570@fai.UUCP> <4969@sdcc6.ucsd.edu> <8630@medusa.cs.purdue.edu> <21215@uflorida.cis.ufl.EDU> Organization: Department of Computer Science, Purdue University Lines: 39 In article <21215@uflorida.cis.ufl.EDU> rs0@beach.cis.ufl.edu (Bob Slaughter) writes: >It isn't really the parameter stack, but the extensibility of Forth >that makes it special. Fortran has function capability and such, but >let me see you add a CASE structure to Fortran, or a WHILE-NEXT to a >standard version of the language the way you can with Forth. Heck, C >is even in the same boat, but it comes with all the flow-control >structures I need already, but if it didn't, I'd be stuck. It isn't >the ability to create new data types, primitives, or the stack; it is >the ability to use the language to make a better language that makes >Forth unique. No, I still claim it is the parameter stack that is the major difference between forth and other languages. Granted, in C or fortran it is ugly to write a function that behaves like a control structure. But one can do it. You must remember that the means to "extend the language" here are functions. As an example, here is what you could do to make a case statement in C: case(key, switches, n, functions) int key, n, switches[], (*functions[])(); { int i; for (i = 0; i < n; i++) if (key == switches[i]) { (functions[i])(); break; } } If you want to take away the 'for' statement, I can make a function that does the same thing from 'if' and 'goto'. Forgetting about C, what makes forth different from common-lisp? In CL one has an interpreter, and can create new control structures on a whim. Further, they look exactly like the rest of the language, just as they do in forth. Forth is definitely not unique as a language in being extensible. -- Bill || ...!purdue!bouma