Re: string_exec()

new topic     » goto parent     » topic index » view thread      » older message » newer message
katsmeow said...
petelomax said...

A context contains enough (error) information to determine precisely what just happened, eg:

code = "a = 1\n"& 
       "b = 2/0\n"& 
       "c = 3" 
context = string_exec(context,code) 

Somewhere in context (I am implying the above is not the first time it is used), there should now be one of:

  • line 1, variable a has not been defined

What if variable a was declared in the program already?

In the caller of string_exec() you mean? In that case, IIUC petelomax correctly, it wouldn't make a difference in his implementation, since the context is still different - so you'd still get that error since variable a was declared in the wrong context.

katsmeow said...

And what if

atom b = 9 
b += 1 
would b now be accessable to the program that called the string_exec()?

No, not in petelomax's implementation, because the context is different.

Edit: well, not directly of course. You probably would be able to do something like "set_string_exec_variable(context, "b", 10)" or "get_string_exec_variable(context, "b")" though.

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu