-
When principal word, for example SEE or DUMP, is factored down into component words, should those component words be subsequently hidden from search, unless they provide some generic function? This is more a question for @ruv, but all opinions welcome. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
The standard does not require hiding non-standard words. It is very likely that in a Forth system As an edge case example, the standard even does not prohibit a Forth system to provide a word like Ideally, I would place only standard and well-known words in Regarding other words, perhaps I would use something like:
To make such a layout convenient to implement and use, you will need some tools. For example, you might have decorators that place a synonym of the latest word in a specific word list, or move the latest definition into a specific word list. : displace-latest-in ( wid -- ) ... ; \ this definition is system-dependent
: private ( -- ) private-wordlist displace-latest-in ; \ move latest to private
: system ( -- ) system-wordlist displace-latest-in ; \ move latest to system Usage example: private-wordlist system-wordlist forth-wordlist 3 set-order
definitions
\ NB: private-wordlist is in the search order
\ ...
/HOLD CHARS BUFFER: _pic private
VARIABLE _>pic private
\ ( char -- )
: HOLD _pic _>pic @ + C! 1 _>pic +! ; Another approach is to use lexical blocks instead of decorators, something like: private{
/HOLD CHARS BUFFER: _pic
VARIABLE _>pic
}private
\ ( char -- )
: HOLD _pic _>pic @ + C! 1 _>pic +! ; There are other variants too. |
Beta Was this translation helpful? Give feedback.
An easy way is to completely remove the names of some words after using them. But accessing internal words is important for debugging, exploring, and create system-dependent Forth extensions. So, I would not remove the names completely.