| Water Contract<method execute_string
env_or_context=null
a_ekind =ekind.code
returns ="last"
file ="No&#32;file"
offset =0/> | |
See also: execute, execute_expression, execute_file
Each expression described in the string is executed in order.
"2.<plus 3/>".<execute_string/>
 | 5 |
If returns is "last" the default, only the value of the last expression is returned.
If returns is "all" then a vector of the values of all the top level expressions is returned.
"env_or_context" is shared for the execution of all the source so you can
set a local variable in one form then use it later in the source.
Typical values for env_or_context are:
null, use the default environment_environment, use the environment of the call to execute_string<environment_of_call/>, to use the calling environment
<method foo w=req>
<set x=5/>
"w.<plus x/>".<execute_string _environment/>
</method>
<foo 7/>
 | 12 |
a wob
| Parameter key | Default value | Type |
| execution_kind | false |
The execution_kind argument determines how a string is to be executed.
a wobexecution_kind=ekind.code
(the default) the source for an argument is evaluated as code.
a wobexecution_kind=ekind.string
The source is not evaluated, nor parsed, it is just used as is, as a string
a wobexecution_kind=ekind.expression
The source is parsed and a parsed representation of the source is returns.
This will be one of the following kinds of objects:
string, number, boolean, null, character, i.e. the literals, and expression_call, expression_path.
a wobexecution_kind=ekind.xdata
The source is parsed and a very limited kind of evaluation is performed.
The types of objects returned will be primitives and data objects
and data_paths.
No lookup of variables occurs and no calls are executed. However, literals
are created. Variables are turned into "symbols", i.e. objects that have
as their parent
symbol and have a name field of the string of the variable.
Calls are turned into water objects with a parent of a symbol of the call name
and fields corresponding to each field in the input whose values have
been executed with an execution kind of
ekind.xdata This are "data objects".
"<foo 2 color='red'/>".<execute_string a_ekind=ekind.xdata/>
 | <<thing.symbol name="foo"/>
2 color="red"/>
|
There are three special rules for calls:
If the name of the call is "char" then the appropriate character is created.If the name of the call is "vector" then a vector is created with
vector fields of values that are the ekind data-executed results of their sources.
If the name of the call is thing then an instance of thing is created.For all other calls, the parent of the returned object is an instance of symbol
having a name of the symbol in the call.
"<vector foo bar 4/>".<execute_string a_ekind=ekind.xdata/>
 | <vector symbol.of.foo symbol.of.bar 4/>
|
"foo.bar.4".<execute_string a_ekind=ekind.xdata/>
 | <field 0="foo" 1="bar" 2=4/>
|
© Copyright 2007 Clear Methods, Inc.