Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uunet!aplcen!uakari.primate.wisc.edu!ames!amdahl!pacbell!noe!marc From: marc@noe.UUCP (Marc de Groot) Newsgroups: comp.lang.forth Subject: Re: Forth Implementation (long) Keywords: Forth implementation Message-ID: <724@noe.UUCP> Date: 22 Nov 89 01:18:48 GMT References: <5172@sdcc6.ucsd.edu> <5599@eos.UUCP> Sender: usenet@noe.UUCP Reply-To: marc@noe.UUCP (Marc de Groot) Organization: Noe Systems, San Francisco Lines: 43 In article <5599@eos.UUCP> jbm@eos.UUCP (Jeffrey Mulligan) writes: >ir230@sdcc6.ucsd.edu (john wavrik) writes: >>Please note that the problem is to add the data type "long" in such a way that >>it has the same status as built-in types. Treating a "long" as an array or a >>"struct" and defining functions like long_add would not do! > >Isn't having a special word "D+" for adding doubles (instead of using "+") >equivalent in a sense to having a special function long_add? Forth does not dictate any particular approach. The Forth Approach says "Do what's good for YOU." Do you want loading of operators so that "+" will add ints and floats, and concatenate strings? Well, you can implement that relatively trivially. John Wavrik's example is unfortunately weak; the point he is trying to make is not. The reserved word "long" is a member of a class of objects which DOES NOT CHANGE. You, the programmer, are not allowed to add to this set of words or change them. The reserved word "+" will add char's short's long's int's and float's and double's. If you want more functionality, you have to program in C++. In straight C, there is no way to change its behavior. Forth is a language which, I am told, is particularly comfortable for object-oriented programming (OOP) . I have no experience with OOP but I have a colleague who enthusiasticly churns out fast, tight, OO code on Amigas using JForth. The point is that in Forth, like in LISP, programs are members of the same class of object as the reserved word set. There is a huge advantage to programming in such a system. The increased flexibility provides for a richness and power not available in other systems. ^M -- Marc de Groot (KG6KF) These ARE my employer's opinions! Noe Systems, San Francisco UUCP: uunet!hoptoad!noe!marc Internet: marc@kg6kf.AMPR.ORG