Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: how many words?

From: larry:ecotope at: 27-Dec-2000 22:13

Hi Ryan About system/words All of the words in all scripts and lines typed at the console, including those used in defining the mezzanine functions, the network protocols and other system objects are added to first system/words (same as rebol/words). It doesn't matter whether they are words, set-words, or lit-words. It also doesn't matter whether they are assigned values. Any word appearing in any context, is added to system. All the words in an object, deep inside nested blocks, even words used just to ask whether it has a value are added to first system/words. No words can ever be removed from first system/words; eventually if you run enough scripts in any one rebol invocation, you will run out of words. The maximum number is of words is currently 4094 (see below). With Core 2.4.39.3.1 (I have 4 or 5 words defined in my user.r)
>> length? first rebol/words
== 1075 Suppose I ask about a word?
>> value? 'abc
== false
>> length? first rebol/words
== 1076
>> last first rebol/words
== abc So asking has added 'abc to the system words, it is the last entry and the count has increased by one. How many of these words have values?
>> defined: []
== []
>> foreach word first rebol/words[if not error? try [get in rebol/words
:word] [append defined :word]] ... return value omitted
>> length? defined
== 410 Only 410 of the 1076 words have values, the rest are unset! or equivalent. How many words can I use:
>> repeat j 4000 [set to-word join "w" [j] j]
** Internal Error: No more global variable space ** Where: to-word ** Near: to word! :value
>> length? first rebol/words
== 4094 The last "w" word made was 'w3012.
>> w3012
== 3012
>> w3013 ;can't do this because it means making a new word
** Internal Error: No more global variable space ** Near: to word! :value About rebdoc.r The script rebdoc.r only looks for words which have a value of the type any-function!. In addition, if show-all is false, all of the words with values of any-function! which were defined after the word 'what are cleared from the list with this line of code: if not show-all [clear next find word-list 'what] I don't know the reason for this particular screening criteria. Perhaps someone else can shed some light on this. Hope this helps Cheers -Larry