[REBOL] word Re:(3)
From: rebol:techscribe at: 14-Aug-2000 15:30
1. memb is a global word in either case.
>> memb: 12345
>> zzz: 87907
>> memb: 343434
>> index? find first system/words 'memb
>> index? find first system/words 'zzz
It stands to reason that:
a) when REBOL parses the word memb it checks in its global wordlist for
memb. If memb is found there it must be associated with the value it is
being assigned. If memb is not found in the global wordlist, then
b) an entry must be created for memb, and then a) must be performed for
this new entry.
In this scenario REBOL must do the same things it does for a previously
defined word memb, plus more, when it creates a new word memb.
Therefore associating an existing word with a new value is cheaper than
creating a new word.
This is true independend of whether you create the word outside the loop as
a separate step. If you did not previously create the word, and you create
the word in the loop, then the first time REBOL encounters the word in the
loop, it will be created (costly), and when it is encountered in the loop
again, it will be re-used (cheaper).
All that is pure speculation and may be completely incorrect :-).
;- Elan [ : - ) ]
author of REBOL: THE OFFICIAL GUIDE
REBOL Press: The Official Source for REBOL Books
visit me at http://www.TechScribe.com