- Proposals Process
- 200x Membership
- 1 Introduction
- 2 Terms, notation, and references
- 3 Usage requirements
- 4 Documentation requirements
- 5 Compliance and labeling
- 6 Glossary
- 7 The optional Block word set
- 8 The optional Double-Number word set
- 9 The optional Exception word set
- 10 The optional Facility word set
- 11 The optional File-Access word set
- 12 The optional Floating-Point word set
- 13 The optional Locals word set
- 14 The optional Memory-Allocation word set
- 15 The optional Programming-Tools word set
- 16 The optional Search-Order word set
- 17 The optional String word set
- 18 The optional Extended-Character word set
- Annex A: Rationale
- Annex B: Bibliography
- Annex C: Compatibility analysis
- Annex D: Portability guide
- Annex E: Reference Implementations
- Annex F: Test Suite
- Annex H: Alphabetic list of words
16 The optional Search-Order word set
16.2 Additional terms and notation
- compilation word list:
The word list into which new definition names are placed.
- search order:
- A list of word lists specifying the order in which the dictionary will be searched.
16.3 Additional usage requirements
16.3.1 Data typesWord list identifiers are implementation-dependent single-cell values that identify word lists.
3.1 Data types, 3.4.2 Finding definition names, 3.4 The Forth text interpreter.
16.3.2 Environmental queriesAppend table 16.2 to table 3.4.
|String Value data type||Constant?||Meaning|
|n||yes||maximum number of word lists usable in the search order|
16.3.3 Finding definition names
When searching a word list for a definition name, the system shall search each word list from its last definition to its first. The search may encompass only a single word list, as with SEARCH-WORDLIST, or all the word lists in the search order, as with the text interpreter and FIND.
Changing the search order shall only affect the subsequent finding of definition names in the dictionary. A system with the Search-Order word set shall allow at least eight word lists in the search order.
An ambiguous condition exists if a program changes the compilation word list during the compilation of a definition or before modification of the behavior of the most recently compiled definition with ;CODE, DOES>, or IMMEDIATE.
A program that requires more than eight word lists in the search order has an environmental dependency.
16.3.4 Contiguous regionsThe regions of data space produced by the operations described in 126.96.36.199 Contiguous regions may be non-contiguous if WORDLIST is executed between allocations.
16.4 Additional documentation requirements
16.4.1 System documentation
188.8.131.52 Implementation-defined options
- maximum number of word lists in the search order (16.3.3 Finding definition names, 184.108.40.2067 SET-ORDER);
- minimum search order (220.127.116.117 SET-ORDER, 18.104.22.1685 ONLY).
22.214.171.124 Ambiguous conditions
- changing the compilation word list (16.3.3 Finding definition names);
- search order empty (126.96.36.1997 PREVIOUS);
- too many word lists in search order (16.6.2.0715 ALSO).
188.8.131.52 Other system documentation
- no additional requirements.
16.4.2 Program documentation
184.108.40.206 Environmental dependencies
- requiring more than eight word-lists in the search order (16.3.3 Finding definition names).
220.127.116.11 Other program documentation
- no additional requirements.
16.5 Compliance and labeling
16.5.1 Forth-2012 systemsThe phrase "Providing the Search-Order word set" shall be appended to the label of any Standard System that provides all of the Search-Order word set.
The phrase "Providing name(s) from the Search-Order Extensions word set" shall be appended to the label of any Standard System that provides portions of the Search-Order Extensions word set.
The phrase "Providing the Search-Order Extensions word set" shall be appended to the label of any Standard System that provides all of the Search-Order and Search-Order Extensions word sets.
16.5.2 Forth-2012 programsThe phrase "Requiring the Search-Order word set" shall be appended to the label of Standard Programs that require the system to provide the Search-Order word set.
The phrase "Requiring name(s) from the Search-Order Extensions word set" shall be appended to the label of Standard Programs that require the system to provide portions of the Search-Order Extensions word set.
The phrase "Requiring the Search-Order Extensions word set" shall be appended to the label of Standard Programs that require the system to provide all of the Search-Order and Search-Order Extensions word sets.
16.6.1 Search-Order words
- 18.104.22.1680 DEFINITIONS
- 22.214.171.1240 FIND
- 126.96.36.1995 FORTH-WORDLIST
- 188.8.131.523 GET-CURRENT
- 184.108.40.2067 GET-ORDER
- 220.127.116.112 SEARCH-WORDLIST
- 18.104.22.1685 SET-CURRENT
- 22.214.171.1247 SET-ORDER
- 126.96.36.1990 WORDLIST
16.6.2 Search-Order extension words
enoch WLSCOPE -- wordlists switching made easierProposal2016-06-18 04:19:03
It is proposed that Forth 200x compliant implementations would be required to offer a deferred word, wlscope (addr len -- addr' len' wid), whose initial implementation is get-current. All the mechanisms that create new dictionary entries would be required to pass the new name ( addr len ) through wlscope to obtain the destination wordlist ( wid ); the name itself may also be altered, hence ( addr' len' ).
Make it easier to manage inclusion of created words on different wordlists. All large software projects carefully regulate their name spaces. Openfirmware, for example, to separate between the "public" words and the "private" words often groups them as follows:
only forth also hidden also definitions ... also forth definitions ...
With wlscope we would like to take this one step further and allow wordlist switches to be driven by the new name itself, in a way that is completely under the programmer control, through a chain of user defined wlscope functions which analyze and perhaps modify the newly created name and determine to which wordlist it is to be added.
The following shows two wlscope "rules" and how to chain them.
Put helper (factorization) words onto a _local wordlist
\ Wordlist scope that puts words with underscore (_) prefix \ on a _local wordlist. :noname ( addr len -- addr' len' wid ) 2dup 1 > if \ name length check s" _" tuck icompare if \ name prefix check _local exit then else drop then [ ' wlscope defer@ ]l execute ; is wlscope
Grow a special use gui wordlist
vocabulary gui :noname ( addr len -- addr' len' wid ) 2dup 4 > if \ name length check s" gui_" tuck icompare if \ name prefix check swap 4 + swap 4 - \ remove gui_ prefix gui exit then else drop then [ ' wlscope defer@ ]l execute ; is wlscope
: _helper ... ;
would automatically add _helper to the _local wordlist while
: gui_init-gl ... ;
would add init-gl to the gui wordlist.
VM asm code at: core/create/docreate.asm and elsewhere.
amforth and amforth-shadow