Static compilers (Xml and Flow) can use runtime parameters to dynamize compiled code during its execution. Parameters are statically typed and double compile-checked, 1st time during DSL declaration, 2nd time during execution call.
Flow example
DSL declaration:
@context( name = 'applicationContext',
params = {x: Float, y: Float, p:hex.structures.Point} )
{
size = new hex.structures.Size( x, y );
anotherSize = new hex.structures.Size( p.x, p.y );
}
Code execution:
var code = BasicStaticFlowCompiler.compile( applicationAssembler, "flow/runtimeArguments.flow" );
code.execute( { x:10, y: 20, p: new hex.structures.Point( 30, 40 ) } );
Static compilers (Xml and Flow) can use runtime parameters to dynamize compiled code during its execution. Parameters are statically typed and double compile-checked, 1st time during DSL declaration, 2nd time during execution call.
Flow example
DSL declaration:
Code execution:
Xml example
DSL declaration:
Code execution: