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-190) local function within context is not resolved if function resolver class without namespace is specified
Date Fri, 26 Feb 2016 15:51:18 GMT

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

Henri Biestro commented on JEXL-190:
------------------------------------

I usually put 'default' functions in the context (i.e extend JexlContext and implement functions
as methods of that class) and only use 'named' namespaces. But nothing in the code precludes
using a 'null' namespace.
Your use-case fix is thus; when solving a function call (without a namespace), if a variable
in the context exists with that name, it will be evaluated and used. The code expects this
variable value to be a 'function' object  (i.e. something that can be called like a function;
a method, a closure, etc) and will fail at runtime if not.
This only restates the fact that a variable - local or global - can mask a (default) method.

> local function within context is not resolved if function resolver class without namespace
is specified
> -------------------------------------------------------------------------------------------------------
>
>                 Key: JEXL-190
>                 URL: https://issues.apache.org/jira/browse/JEXL-190
>             Project: Commons JEXL
>          Issue Type: Bug
>    Affects Versions: 3.0
>            Reporter: Dmitri Blinov
>            Assignee: Henri Biestro
>
> {code}
> z = function(x) { return x + 1}; return z(1)
> {code} returns error unsolvable function/method 'z' while 
> {code}
> var z = function(x) { return x + 1}; return z(1)
> {code} returns 2



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

Mime
View raw message