Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!husc6!cmcl2!acf5!sabbagh From: sabbagh@acf5.NYU.EDU (sabbagh) Newsgroups: comp.lang.forth Subject: Re: Vocabularies Message-ID: <1219@acf5.NYU.EDU> Date: 18 Aug 90 17:34:43 GMT References: <1529.UUL1.3#5129@willett.pgh.pa.us> <1530.UUL1.3#5129@willett.pgh.pa.us> Reply-To: sabbagh@acf5.UUCP () Organization: New York University Lines: 61 In article <1530.UUL1.3#5129@willett.pgh.pa.us> dwp@willett.pgh.pa.us (Doug Philips) writes: >(BTW: Just because Forth has traditionally been filled with mixed-fixed >words doesn't mean it can't grow into a more cleanly factored language >which contains both the old style prefix words *and* the components that >such words are built from. I'm still not clear on how much you can bend >Forth and still call it Forth. Fig-Forth, Forth-79, Forth-83. Perhaps >in the end it is merely the philosophy which allows you to call the >language Forth. But this is really a different topic). > Time for my $0.02 1) Poorly factored CREATE This is one of my all-time gripes about Forth. I think that the reason this wasn't factored properly from the beginning is that strings were added to Forth AFTER its original inception. (Aside: most of the discussions about Forth ignore its history, which I believe to be very important in understanding why a language is the way it is). CREATE (and other words) can be easily refactored as "take next word from input stream then invoke $CREATE" which takes a string argument. THis means that strings would have to be standardized. (Are you listening ANSI dudes?). 2) Mixed-fixed I do not have any problems with the mixed-fixed nature of Forth; for those who are real purists, check out Postscript which is an entirely postfix language. It uses the concept of anonymous code blocks delimited by {} then {...(code)...} /foo def would define a new word named foo. This works too, but I like Forth better. 3) A modest proposal for vocabularies (ANSI dudes out there?) What are vocabularies? They are lists of (key,value) pairs! Why not define them abstractly, simply by having each vocabulary provide its own words for creation, deletion, listing and finding such pairs in its own internal structure? Also, allow each vocabulary to decide what a number is. Vocabularies could then be kept on a stack, and the inner interpreter would call the FIND word for each vocabulary in the stacked order, until one of them recognizes the word. This is the most general solution to the vocabulary issue, especially since this would be transparent to the user, most of the time. It also addresses the issue of what to do if you want to add new number types, literals, etc. to Forth. Hadil G. Sabbagh E-mail: sabbagh@csd27.nyu.edu Voice: (212) 998-3125 Snail: Courant Institute of Math. Sci. 251 Mercer St. New York,NY 10012 "'He was killed by the usual cabal: by himself, first of all; by the woman he knew; by the woman he did not know; by the man who granted his inmost wish; and by the inevitable fifth, who was keeper of his conscience and keeper of the stone.'" -R. Davies, "Fifth Business"