commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rahul Akolkar <>
Subject Re: [scxml] double evaluation of expr in assignments
Date Thu, 12 Aug 2010 20:00:48 GMT
On Thu, Aug 12, 2010 at 2:51 PM, Fabrizio Morbini <> wrote:
> Hi,
> problem: i would like to assign to a variable, v1, the value of
> another variable, v2, but the name "v2" is the result of an
> expression. For example, assume you have an inspect event that should
> assign to a predetermined variable the value of the variable whose
> name is passed as payload to the inspect event.
> attempted solution: add a new parameter to the scxml assign action.
> The new parameter is a boolean that if true allows to evaluate the
> result of the first evaluation of the expr field of the assign action.
> In the example above, if the expr is
> "_eventdatamap.get('inspect').get('varName')" the first evaluation
> will return "v2" the second evaluation will return the value of "v2"
> in the datamodel.
> question: this seems a common situation and i wonder if there is
> already a solution.

The above is like a gensym operation (generate symbol) and there isn't
a standard solution. As you point out, its possible to do this with a
variant of the assign action.

Depending on the expression language and data structures, you can get
some "pseudo-gensym" behavior (for example, when using JEXL you may
generate the key for a map using an expression within the [ ]
operator). In SCXML, the underlying datamodel context is itself like a
map, but it isn't exposed directly to the expressions as such.


> thanks

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message