You. Forth. Simplicity.

git repository
download
prior releases
documentation wiki
issue tracker
mailing list and forum
irc channel and logs
try it


This wiki remains, like the original forum, mainly for historical value. There is a new wiki which, while having less content, is more secure and oriented towards modern Retro implementations.

reload node | edit | recent changes | front page

Lexical Scope

Another important aspect is the scoping abilities provided by the Rx Core. The lexical scope constructs allow a good deal of control over how you can factor and what is made visible to the dictionary. By using the words loc: and ;loc you can create lexically scoped regions of code and then use alias or is to expose specific definitions in these regions. A simple example of their use would look like:

loc:
10 constant ten
20 constant twenty
10 20 * constant two-hundred
:: two-hundred ;
;loc is value

When a lexically scoped region is closed with ;loc, the word headers up to the previous loc: are dropped from the dictionary. You can use anonymous definitions with alias or is to expose what is needed. Also (not shown in the example), you can nest lexically scoped sequences. Nesting is possible up to four levels deep. Lexical scopes are used frequently by the developers of Rx and allow a good level of factoring without polluting the actual dictionary with words that are not needed outside a select few definitions.