Path: utzoo!attcan!uunet!mcsun!hp4nl!tuegate.tue.nl!rc6.urc.tue.nl!eutws1.win.tue.nl From: wsbusup@eutws1.win.tue.nl (Jan Stout) Newsgroups: comp.lang.forth Subject: The Right Dictionary Structure Message-ID: <67@rc6.urc.tue.nl> Date: 26 Sep 90 13:19:48 GMT Sender: News Administration Organization: Eindhoven University of Technology, The Netherlands Lines: 45 Recently having obtained a copy of FIFTH, I started to wonder about the Right Way for Forth's dictionarystructure. First let me explain what the FIFTHmakers concocted: In FIFTH every word is also the name for a possible subdictionary containing words that may ONLY be used by the word that acts as the dictionaryidentifier. To clarify, let's draw some piece of dictionarytree: : SPACES 0 ?DO SPACE LOOP ; \ : SPACE BL EMIT ; | \ \ 32 CONSTANT BL CODE EMIT ... END-CODE Imagine the current dictionary to be BL, the search order would now be: 1 search BL's subdict. (empty in this case so:) 2 search BL itself (ensuring that the searched for word is not BL then:) 3 search BL's LEFT neighbours (but not their subdicts! so in this case only a test against EMIT would result .) 4 search BL's parent and his left neighbours until one stumbles over FIFTH (the word at the root) The idea behind all this was to eliminate the headaches of watching long WORDSlists by listing only the subdict of a desired word. The result of the implementation however was that when defining a word like CR on the same level as SPACE ( : CR 13 EMIT 10 EMIT ; ), while EMIT was in SPACEs subdict. you would have to define EMIT for CR too! An "obvious" solution is to place EMIT in the rootdictionary, but this is back to square 1 because the rootdictionary would grow out of control (As I think it has in FIFTH) I'd like to know if anyone out there who has been thinking 'bout this, and has come up with anything near a solution. My own suggestion would be to let FIND search all (sub)dicts that are BELOW, LEFT or ABOVE a given word. (in that order). The application word then would be in one of the most LEFT subdicts. Perhaps if someone wonders why I consider ONLY no solution is that it tends to increase dictionarylength because the hardships required to invent a name for every dictionary created... As every word should contain about 7 words it should make sense to create equaly large dicts)