Re: string_exec()
- Posted by dcuny Feb 28, 2015
- 2559 views
I'd assume that there string code would be running in it's own context.
It would be nice if there were a way to pass values to that context, such as:
-- compile code into a context {aContext, resultCode} = compile_code("myfile.ex") -- set top-level value for variable "some_string" to "a_value" {aContext, resultCode} = set_value(aContext, "some_string", "a value") -- execute procedure in context {aContext, resultCode} = call_routine(aContext, "some_procedure", {1,2,3}) -- execute function in context {aContext, returnValue, resultCode} = call_routine(aContext, "some_function", {1,2,3}) -- create an empty context that code can be compiled to sequence newContext = create_context() -- compile code into the context {newContext, resultCode} = compile(newContext, "integer a\na=22") -- retrieve top-level "a" value from the context {result, resultCode} = get_value(newContext, "a")
I'd also assume that if there was an error while executing something in the context, there would be routines for retrieving that information.
- David