The heat is on FORTH

COTTRELL, JAMES cottrell at NBS-VMS.ARPA
Thu Feb 20 07:23:22 AEST 1986


/*
> I agree with the supporters of FORTH that it is a usable language, and that
> with some discipline, a programmer can turn out good FORTH code.  However,
> there IS indeed one area in which FORTH is much weaker than any other
> language, and this is the area of net-effect.  A FORTH word can do any
> amount of damage to the runtime stack (value stack).  There is really no
> limit, and this is simply due to the fact that the average FORTH
> implementation has no control of the amount of the value stack that a
> routine can push or pop.  In "real" languages, we have a net-effect
> property, which guarantees that the arguments to a function are popped off,
> and the return value from a function in put in their place, after function
> call.  This makes much of programming much easier, and, most importantly, IS
> IN THE LANGUAGE SPECIFICATION.  FORTH programmers may enforce this rule
> themseleves, but by golly it sure is nice of the compiler to do it for us C
> programmers.  It lets us spend time where we should, worrying about
> algorithms and such.
> 
> --chet-- (chet at rice.arpa)

All you're saying is that the Stack is a primitive data type in FORTH &
not in C (or Pascal, Fortran, Ada, etc). Your criticism sounds much like
saying that since pointers can point anywhere in C that they are dangerous.
In fact, FORTH has TWO stacks, one for data & one for procedure (word)
calls & DO loops. The call stack is maintained much the same as in
conventional languages. I wish I knew who said the following:
`Saying that the C language is dangerous presumes the existence of a 
safe one'. The same goes for FORTH, LISP, FORTRAN, PASCAL, ADA et al.

	jim		cottrell at nbs
*/
------



More information about the Comp.lang.c mailing list