Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
Description
The current basic behavior of namespaces only allows stateless execution.
In some cases, this is not convenient enough (SCXML for instance); by having namespaces instantiated at script/expression evaluation time and passing the JexlContext as their constructor argument, the namespace can define members that functions (namespace methods) can use. It makes namespaces almost as potent as regular JexlContext variables, full blown objects.
Convention will be that a namespace whose value is a class having a constructor that uses a JexlContext as argument is such a 'stateful' namespace.
They are instantiated on need and their lifetime spans the evaluation call.
Experience suggests that the JexlContext should probably be derived to contain the information necessary to instantiate the namespace without polluting the variable space.