Modules: no global words

Carl Sassenrath, CTO
REBOL Technologies
1-Sep-2006 7:20 GMT

Article #0044
Main page || Index || Prior Article [0043] || Next Article [0045] || 12 Comments || Send feedback

R3.0 has no global context. Each module provides its own "global context".

This change is important for these reasons:

  1. It makes modules truly independent namespaces. For example, changing the value of a system word does not affect the value of that word in other modules. E.g. if you want to set system to none, it's no longer going to crash REBOL.

  2. It allows special system words and plugin component words to be optimized without the word table limitation that occurs in 2.0. (The 2.0 limitation comes from C pointers directly referencing important system values, so that context can never be relocated in memory.)

  3. The system/words object no longer holds all words. Instead, it holds the words that your script module knows about, which does include many system functions/objects, but only those that have been exported to your script.

Note that when you run a script in REBOL, a runtime module is built to serve as the global context for that script.

Note that this change also allows REBOL to be more secure, but at the cost of full system access reflectivity. This changes the way you probe the system to see how it works or to make patches. (You can still do that, but your script requires the necessary security permissions.)

I mentioned this in an earlier article. This is just a reminder under the module thread.


Updated 14-Jun-2024 - Edit - Copyright REBOL Technologies -