Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utcs!mnetor!seismo!rochester!ritcv!cci632!rb From: rb@cci632.UUCP Newsgroups: net.lang Subject: Re: Extensibility (Re: RRe: What's so good about FORTH? Message-ID: <211@cci632.UUCP> Date: Fri, 11-Jul-86 20:56:08 EDT Article-I.D.: cci632.211 Posted: Fri Jul 11 20:56:08 1986 Date-Received: Wed, 16-Jul-86 03:28:13 EDT References: <201@pyuxv.UUCP> <3700003@uiucdcsp> <132@vaxb.calgary.UUCP> <152@cci632.UUCP> <770@ucbcad.BERKELEY.EDU> <473@astroatc.UUCP> Reply-To: rb@ccird1.UUCP (Rex Ballard) Organization: CCI, Rochester Development, Rochester, NY Lines: 41 Keywords: FORTH, threaded-code Summary: How to get "object oriented forth". In article <473@astroatc.UUCP> philm@astroatc.UUCP (Phil Mason) writes: >In article <770@ucbcad.BERKELEY.EDU> faustus@ucbcad.BERKELEY.EDU (Wayne A. Christopher) writes: >>Perhaps this discussion is bothering some people, but I have another >>question about forth for the gurus on the subject . . . > >This IS net.lang. This is what this news-group is for. Now if we were on >net.women . . . > >As you were saying ... >>The major >>advantage of C (as I see it) over Fortran, etc is the possibility of >>defining structures and abstract types. Does forth have anything >>comparable, or are there any forth paradigms that make this easy? > >Yes, there are the Builds(Create) - Does words that can define a new class >of words. The Builds(Create) words allocates the proper space and does >any necessary initialization. Does describes the run-time behavior of the >new word. A short time ago, a gentleman posted a 16 line Forth implementation >of Pascal record structure types on net.lang.forth. You can very succinctly >describe any data structure you want either from scratch with Builds(Create)- >Does or a set of tools that use them. > >>Also, what sort of position does forth take in the spectrum with functional >>programming on one end and object-oriented programming on the other? >>It seems to me that (like C) forth doesn't really try to deal with this >>problem... > If you write your various operations, then build a "class switch" word, then use the : Class builds (size) alloc does class_funtion ; you have a class which will implicitly define its own object (like new). By creating "stack constant" operators such as : Print 1 ; You can say Class object Print object And your object, of whatever type would be printed. Cute? :-).