commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Henri Biestro (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (JEXL-237) Ability to restrict usage of certain names when declaring local variables
Date Fri, 14 Jul 2017 12:53:00 GMT

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

Henri Biestro commented on JEXL-237:
------------------------------------

The only case of potential problem we can detect (and preclude) at parsing time is assigning
a global variable.

Detecting whether local variables (i.e. those defined by the 'var' keyword) clash in name
with global (i.e. undeclared, determined at runtime) would suggest creating/parsing scripts
with a 'prototype' of their evaluation context that would contain these expected global variables
(and their potential sets of types so we could perform type inference and further static method
& operators checks, sweet...).
This can also be implemented as a specific execution pass on a script just after creation;
extracting locals 'JexlScript.getVariables(...)'and check though 'JexlContext.has(...)' whether
any clashes and throw an ex in that case.

Seems to me the first step forward would certainly be able to parse with a 'no assignment
to global variable' set (which is related to the no-side-effect expression task).

> Ability to restrict usage of certain names when declaring local variables
> -------------------------------------------------------------------------
>
>                 Key: JEXL-237
>                 URL: https://issues.apache.org/jira/browse/JEXL-237
>             Project: Commons JEXL
>          Issue Type: Wish
>    Affects Versions: 3.1
>            Reporter: Dmitri Blinov
>            Priority: Minor
>
> One of the errors the scriptwriter usually makes is an accidental override of certain
context variables with his own local variables, which leads to nasty bugs detected only when
script is executed. As of now there is only a small list of reserved words that can not be
used as a valid variable name, and it is restricted to basic Jexl syntax keywords. When Jexl
syntax is extended with custom functions and predefined context variables, its much easier
for a local variable name to clash with predefined name, thus altering script execution further
on. To exclude those errors it is needed that a custom name verification would exist, prohibiting
the scripts from be successfully parsed.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message