[ 
https://issues.apache.org/jira/browse/JEXL-200?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Dmitri Blinov updated JEXL-200:
-------------------------------
    Description: 
Allow for dynamically defined functions inside a script where the definition of 
the function comes from a string expression, for example:

{code}
var x = function(y) => "return y+2";
{code}

the defined function should be accessible after its definition is successfully 
parsed as ordinary function, and can be evaluated in the current context.

{code}
if (x(40) eq 42) {...
{code}

I think the idea of dynamic script evaluation is not unusual, and though to 
some extent can be implemented via side-added functions like *eval(expr)* a 
dedicated syntax for this will benefit from the simplicity of ordinal functions 
and the ability to control mapping of the arguments between a caller and the 
defined function.

  was:
Allow for dynamically defined functions inside a script where the definition of 
the function comes from a string expression, for example:

{code}
def x(y) = "return y+2";
{code}

the defined function should be accessable after its definition is successfully 
parsed as ordinary function, and can be evaluated in the current context.

{code}
if (x(40) eq 42) {...
{code}

I think the idea of dynamic script evaluation is not unusual, and though to 
some extent can be implemented via side-added functions like *eval(expr)* a 
dedicated syntax for this will benefit from the simplicity of ordinal functions 
and the ability to control mapping of the arguments between a caller and the 
defined function.


> Support for dynamic scripting in jexl scripts
> ---------------------------------------------
>
>                 Key: JEXL-200
>                 URL: https://issues.apache.org/jira/browse/JEXL-200
>             Project: Commons JEXL
>          Issue Type: New Feature
>    Affects Versions: 3.0
>            Reporter: Dmitri Blinov
>            Priority: Minor
>
> Allow for dynamically defined functions inside a script where the definition 
> of the function comes from a string expression, for example:
> {code}
> var x = function(y) => "return y+2";
> {code}
> the defined function should be accessible after its definition is 
> successfully parsed as ordinary function, and can be evaluated in the current 
> context.
> {code}
> if (x(40) eq 42) {...
> {code}
> I think the idea of dynamic script evaluation is not unusual, and though to 
> some extent can be implemented via side-added functions like *eval(expr)* a 
> dedicated syntax for this will benefit from the simplicity of ordinal 
> functions and the ability to control mapping of the arguments between a 
> caller and the defined function.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to