REBOL 3.0

Comments on: Decision on multicontext variable lookup

Carl Sassenrath, CTO
REBOL Technologies
18-Jun-2008 21:29 GMT

Article #0140
Main page || Index || Prior Article [0139] || Next Article [0141] || 3 Comments || Send feedback

I recently asked the question: Is there value in providing a method to lookup variables over multiple contexts? (blog 138)

This question bubbled to the top from an addition made to the delect function. There are times when using delect on a block where you want the variable values to be obtained from a specific context or better yet, a collection of contexts.

After a couple weeks of evaluating this question and trying a few examples, I've reached these conclusions:

  • Multicontext lookup is useful for the singular lookup in function. It saves steps and can speedup your code. So, this feature will be provided.
  • Multicontext lookup is not useful for block evaluation (the delect and the reduce functions.) It is slower, and in fact would slow down the entire evaluation process (because it adds overhead to the runtime state of the interpreter).

To handle the block evaluation cases, it would be better to provide multcontext binding in the bind function by allowing:

bind block [context-1 context-2 ...]

We've talked about doing this before, so perhaps the time has come to do so.

Also, this can also be optimized to be many times more efficient than a evaluation-time multicontext lookup.

3 Comments

Comments:

Brian Hawley
19-Jun-2008 10:53:05
That will definitely help, and keep the speed we have come to enjoy in REBOL. I look forward to seeing what can be done with these additions.
Paul LYS
24-Jun-2008 17:30:45
I may be late on this issue, but I think it is better to promote "object" management of variables rather build a process of blindness.

This will complement the post on func-local, namely: I think it is better if the programmer had a thought for a global variable (bearing in mind the consequences of such a choice). In doing so it will reflect on the contexts and could choose to integrate its variable in an object.

Brian Hawley
26-Jul-2008 15:04:23
Paul, you will probably like R3's modules. That is how R3 is managing contexts - there won't really be a global context, just module contexts, exported and imported words.

Post a Comment:

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

Name:

Blog id:

R3-0140


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-Nov-2017 - Edit - Copyright REBOL Technologies - REBOL.net