home .. forth .. colorforth mail list archive ..

RE: [colorforth] Re-connecting


> Rather than have the forth word 'Forth' which holds the link 
> to the latest
> definition, you have 'Context' and 'Current'. 
> 
[...]
> 
> This is different from all other forths I have seen which use 
> *hack* hashed
> and or vocabulary stacks. You run out of vocabularies just 
> when you need them
> most or, if hashed, just add needless complications.
> 

In earlier versions of 4IM I used to have nested voc capabilities. I have
removed then, but the feature is somewhat 'sleeping',  waiting to be used if
needed.
The word 'FORTH' is a value which is a pointer to two memory cells. The
first holds the latest "regular" definition, and second the latest "macro"
definition. One could create a new vocabulary with VOC: . Basically, VOC:
CREATEs the word and allots two cells; but these cells are initialized with
those pointed by FORTH, so that the new vocabulary "inherits" of the words
of it's parent voc. To complete the scheme, I had a word "\", which executes
the next word in the context of the voc given on the stack. For instance:
VOC: EDITOR
EDITOR \ : ED ~~~~ . ( creates ED in editor )
EDITOR \ WORDS ( lists EDITOR vocabulary )
As you can see there's no distinction between a "current" and a "context"
voc, there's just a context ( pointed by FORTH ).

"\" did nothing more than ticking the next word, assigning FORTH, executing
the ticked word, then restoring FORTH.
This mechanism only requires that FIND fetch the FORTH word first, or take
the vocabulary where to search on the stack, and one can build tall/large
voc tree if one wishes.

I have a question for you CF coders somewhat related to the current
discussion. If I've looked towards vocabularies and OO, this is because I'm
a bit in trouble with how to name things when an applications gets a bit
"wide". For instance, if you have many different data structures and all of
them have a field where you store the human-readable name of an object, you
would like to have the word NAME for fetching this field but you cannot
because it can be at different locations in each data structure, so you have
to name ITF-NAME for the structure that describes an Interface,
COMPUTER-NAME for computers, etc. One nice solution would that you manage
things so that they are at the same location but it would incur some
penality elsewhere.
Ideas?

 Amicalement,
  Frederic

---------------------------------------------------------------------
To unsubscribe, e-mail: colorforth-unsubscribe@xxxxxxxxxxxxxxxxxx
For additional commands, e-mail: colorforth-help@xxxxxxxxxxxxxxxxxx
Main web page - http://www.colorforth.com