@nedzadarek what you seem to call a "variable" is a binding + relation between symbol ID and value inside context.
What is SYMBOL ID ? I am getting confused. Could you make a graph adding real words, blocks and arrows to this structure and also underliyng C like rappresentation of the data structure ?
Word reference its context through a node (just a special intermediate structure) and has a symbol ID, which is an index in a symbol table. Context, in turn, is just a two-column table: first column is for
symbol! slots, second one is for
When a word is evaluated, a value is fetched in the context pointed by that word, from the value slot that correspond to the symbol ID held by the word. In that sense, words is an instance of an internal
symbol! datatype: word = a context reference + a symbol ID.
Symbol table, as I understand it, is nothing more than block of
symbol! cells, one per Red session currently (should be one per module in the future). Symbol ID is an index of a cell in that block.
symbol! cell holds a UTF-8 representation of a word (its "spelling", it's actually a pointer to a string buffer, again through node) and an alias field. If word is an alias of the other word (think case-insensitivity), this field will hold an index of the original word.
cell!: alias struct! [ header [integer!] ;-- cell's header flags data1 [integer!] ;-- placeholders to make a 128-bit cell data2 [integer!] data3 [integer!] ]
@nedzadarek so, now you disagree with technical details and objective facts? Whatever.
Words and variables are different both in their implementations and at conceptual level. Words can serve as variables in a very, very special sense (to the degree that you can't just call them "variables" without wasting your breath on 1-2 hour explanation of difference between the two) , but they are not variables, neither technically (they differ in implementations) nor conceptually (we use "words" and "bindings" for a reason!).
any-word!s are bound to
system/words("global context") on
loadphase and are
unset(there's no value associated with them). Then, at run-time, words are rebound by functions to other contexts, change their values in the available conexts, or remain untouched.