loadScript(string scriptname) in local closure

Please, don’t read this post.
Your time is probably better used by reading: http://en.wikipedia.org/wiki/Object-capability

I just wake up and was dreaming about importing code in code.
And as I am now wake up, what I thought is just what I already thought but more clear.

Basically, when loading a script, you want it to execute in some security context.
What I had already thought was just give it a local environment (a closure, but I don’t like that word too much because my understanding of it is still fuzzy).

But basically, let it load as if it was written at that point in the script.

So basically it give something like this:

import player;
import communication;
import level;

Context c = localContext();

[some new functions here]

mylevel = level.load(“test.nw”)
for each NPC in mylevel
loadScript(NPC.script, c) // load the script within the ‘security’ context c

export Everything; [/CODE]

That way, scripts are like if they were written at the ‘Context c = localContext()’.

It still not polished, but the basic idea is there.
Because of where the loadScript happens, the script can only call and execute functions it knows about.

I guess, it basically means the script is not allowed to import it’s own stuff.

It might be that most system already use that, or not, I frankly just don’t know.
Now that I write it, it looks a bit like capabilities in a sense.

Basically, it seems to means, make explicit in the language, the context.
And allows to define functions (load scripts) in that context.
So, if they cannot import stuff, they are confined to what they know (the context), and this is a security context in which they execute.

Heu, yes, this message will be seen as me trolling once more.
Ok, maybe… guess it is because I share incomplete ideas.

Basically in let’s say Pascal you could have:

[CODE]int funca (int a, int b){
return a + b;

int funcb (){
int funcinb( int c){
return c+2;
return 16+funcinb();

In a language with explicit context it could become:

[CODE]Context c = new Context();

c.addFunction(“int funca (int a, int b){
return a + b;

c.addFunction(“int funcb (){
Context c2;
c2.addFunction(“int funcinb( int c){
return c+2;
return 16+c2.execute(“funcinb”);

See how my idea, make simple things, so much more complicated!

How is this any different from objects?