REBOL 3.0

Comments on: Yanking the Global Net

Carl Sassenrath, CTO
REBOL Technologies
26-Sep-2010 17:34 GMT

Article #0335
Main page || Index || Prior Article [0334] || Next Article [0336] || Post Comments || Send feedback

As you know (or maybe not), REBOL does not have globals. What we have is a default binding context (which is under the control of developers.)

In prior versions of R3 (including R2) mezzanine functions were created during boot within a default context. As of A108, this is no longer true. Mezz functions created by the system during boot no longer have a "global net" to catch them if they "escape".

The benefit of this is that internal words of mezzanine functions no longer appear within the run-time lib (system/contexts/lib context, previously known as exports). This cuts the size of the lib substantially and makes it generally a lot cleaner.

If you think about, this is really the way the runtime lib should be. There shouldn't be any globals floating around in there, other than the official exports of the lib itself.

But, it also means that mezzanine function developers must be more careful. If you create a function with a word that has no context, it remains that way! Unbound. And, it will error out at runtime. There is absolutely no forgiveness.

Of course, user programs are a different story. In those, all program code is bound by default into the user context, so the "global net" still exists for user programs.

Of course, it might be useful to develop a version of func that does not allow globals. That's easy to design if you want no externals at all: unbind the body, then bind it with lib only. Any kid can write that. Very pure. But... maybe not so useful, because you'll want to be able to call your own functions too, which live in user context.

There's probably some nice balancing point somewhere.

Post Comments

Post a Comment:

You can post a comment here. Keep it on-topic.

Name:

Blog id:

R3-0335


Comment:


 Note: HTML tags allowed for: b i u li ol ul font span div a p br pre tt blockquote
 
 

This is a technical blog related to the above topic. We reserve the right to remove comments that are off-topic, irrelevant links, advertisements, spams, personal attacks, politics, religion, etc.

REBOL 3.0
Updated 19-Apr-2024 - Edit - Copyright REBOL Technologies - REBOL.net