how many words?
[1/3] from: rchristiansen:pop:isdfa:sei-it at: 27-Dec-2000 17:21
Using /Core 2.4.39.3.1 for Windows, I discover there are 1,132 'words
in /Core.
>> foreach word first system/words [w: w + 1]
== 1132
But when I run %rebdoc.r it generates a dictionary list of only 276
words.
Meanwhile, if in %rebdoc.r I make 'show-all "true" instead of "false" it
generates a dictionary list of 327 words.
Why the discrepency?
-Ryan
[2/3] 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
[3/3] from: timewarp::sirius::com at: 28-Dec-2000 6:30
Larry Palmiter wrote:
> 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.
well, at the time i put that in reboldoc.r, it was the last
word defined internally as rebol was executed and initialized.
i would imagine a lot has changed since then. couldn't think
of a more appropriate method of screening at the time. and it
seemed to work well for it's purposes.
might flag the rebol tech folks to have a look at this and
make sure it's still an appropriate method of screening out
the newly defined words from the ones internal to rebol.
cheerfulness,
-----EAT