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

[REBOL] word Re:(3)

From: rebol:techscribe at: 14-Aug-2000 15:30

Hi Tim, 1. memb is a global word in either case. 2.
>> memb: 12345
== 12345
>> zzz: 87907
== 87907
>> memb: 343434
== 343434
>> index? find first system/words 'memb
== 1402
>> index? find first system/words 'zzz
== 1403 Aha. 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 http://www.REBOLpress.com visit me at http://www.TechScribe.com