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 2019/03/28 11:36:00 UTC

[jira] [Comment Edited] (JEXL-295) Add unary plus operator

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

Henri Biestro edited comment on JEXL-295 at 3/28/19 11:35 AM:
--------------------------------------------------------------

You're right, the rule of lesser surprise implies it should only perform integral promotion as default op (like c/java/c++/c#).



was (Author: henrib):
You're right, the rule of lesser surprise implies it should only perform integral promotion as default op (lie c/java/c++/c#).


> Add unary plus operator
> -----------------------
>
>                 Key: JEXL-295
>                 URL: https://issues.apache.org/jira/browse/JEXL-295
>             Project: Commons JEXL
>          Issue Type: New Feature
>    Affects Versions: 3.1
>            Reporter: Henri Biestro
>            Assignee: Henri Biestro
>            Priority: Major
>             Fix For: 3.2
>
>
> WHAT
> Introduce a new operator, the unary plus as in '+4' or '+b' expressions. JEXL arithmetic already allows using a unary minus operator (the negate operation) so there is logic in having the counterpart.
> The proposed default behaviour would be to:
> - call the 'Math.abs(...)' method for numbers
> - return true for boolean 
> - could uppercase strings ? (should '-' lowercase strings ??)
> HOW
> - Follow the unary minus syntax and construct in the .jjt / ASTUnaryPlus / ParserVisitor
> - Implement Interpreter, Debugger
> - Implement abs in JexlArithmetic



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)