You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Henri Biestro (JIRA)" <ji...@apache.org> on 2011/07/17 20:33:00 UTC

[jira] [Resolved] (JEXL-114) Allow scripts to create local variables // Add return keyword

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

Henri Biestro resolved JEXL-114.
--------------------------------

    Resolution: Fixed

Committed revision 1147694.

> Allow scripts to create local variables // Add return keyword
> -------------------------------------------------------------
>
>                 Key: JEXL-114
>                 URL: https://issues.apache.org/jira/browse/JEXL-114
>             Project: Commons JEXL
>          Issue Type: New Feature
>    Affects Versions: 2.0.1
>            Reporter: Henri Biestro
>            Assignee: Henri Biestro
>             Fix For: 2.1
>
>
> WHY:
> Not having local variables nor return in scripts is inconvenient, especially when dealing with loops.
> This also precludes using read-only contexts easily which are really convenient when letting end-users enter their own expressions.
> HOW:
> This could (will) be implemented by extending the parameters feature (script accept parameters during parsing and thus arguments during evaluation) which is itself based on the notion of 'registers' - an array of objects that the interpreter allocates and uses based on script information.
> It only requires adding one keyword ("var" seems the obvious choice) in the .jjt.
> The "return" keyword is also an easy .jjt addition; obvious implementation is to use an internal exception to force traversing the stack up.
> WHAT:
> Add the "var" and "return" keyword.
> Also add methods to extract the variables (global - see JEXL-113), the parameters (used during parsing) and the local variables (declared within) a script to help pinpoint problems or prepare the evaluation of scripts.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira