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 2023/07/10 07:15:00 UTC

[jira] [Resolved] (JEXL-400) modify primitive value in lambda/function does not affect original value

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

Henri Biestro resolved JEXL-400.
--------------------------------
    Resolution: Not A Bug

Captured local variables in a lambda are copied in the lambda frame; in Java, this are made const/immutable. In JEXL, those copies are not immutable but they still are copies; modifying is local to the lambda lexical scope.

> modify primitive value in lambda/function does not affect original value
> ------------------------------------------------------------------------
>
>                 Key: JEXL-400
>                 URL: https://issues.apache.org/jira/browse/JEXL-400
>             Project: Commons JEXL
>          Issue Type: Bug
>            Reporter: Xu Pengcheng
>            Priority: Major
>
> {code:java}
> let count = 0;
> function inc() {
>   count ++;
>   // here count is 1
> }
> inc();
> // here count is still 0{code}
> It maybe not a 'bug', just seems making it as a global variable and keep the value consistently  makes more sense.
> Thanks!
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)