[ 
https://issues.apache.org/jira/browse/JEXL-307?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16975645#comment-16975645
 ] 

Henri Biestro commented on JEXL-307:
------------------------------------

I may be missing your actual question but just because the lexical feature is 
not equivalent to the lexical option. 

Having seen many very heavy scripts (>2000 lines) and the most common source of 
bugs, any _brand new_ solution using scripts should use the lexical feature and 
"+lexical +lexicalShade -safe +strict" options IMHO.

The lexical feature throws a *parsing* exception when a variable is redeclared 
whilst the lexical option throws exceptions at *execution* time (and that 
option can be enabled/disabled at will through the jexl.options pragma). If 
scripts are created before being used, the former fails at construction time - 
and may prevent a whole app to start -, the latter at runtime - which may fail 
some operation of that same app.

Considering any _existing_ solution using scripts, a smooth migration towards 
using 3.2 safer scripting capabilities and the implied refactoring needs to be 
achievable one script at a time; the current JEXL-307 implementation fits that 
purpose.

(Production, migration, upgrade, support, legacy, resilience, stability... 
burden vectors  :)) 

> Variable redeclaration option
> -----------------------------
>
>                 Key: JEXL-307
>                 URL: https://issues.apache.org/jira/browse/JEXL-307
>             Project: Commons JEXL
>          Issue Type: New Feature
>    Affects Versions: 3.1
>            Reporter: Dmitri Blinov
>            Assignee: Henri Biestro
>            Priority: Minor
>             Fix For: 3.2
>
>
> As of now, JEXL allows a script writer to redeclare a local variable during 
> script evaluation.
> {code:java}
> var a = 1; var a = 2;{code}
> This may lead to potential errors with misspelled names and clashed 
> variables. Checking for already defined variable is a common feature of many 
> languages. This feature can be implemented in JEXL as an additional option of 
> JexlFeatures class, enabled by default, thus allowing compatibility with 
> existing code.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to