[
https://issues.apache.org/jira/browse/JEXL-295?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16803704#comment-16803704
]
Dmitri Blinov commented on JEXL-295:
------------------------------------
IMHO it's very confusing for any programmer with background of java/c/c# to
have unary plus operator to change a negative number to a positive. For many
years people were taught that +x does not change sign. I know this is a legacy
question, but may be we should keep basic implementation of unary plus operator
this way, while aloowing the option of overloading it for those who want to use
it other way?
> 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)