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

Henri Biestro commented on JEXL-226:
------------------------------------

The Elvis operator casts the left-hand side to boolean; The 'null coalescing' 
operator does not.
{code}
// x is not defined
x ?? 'other value' ; // 'other value'
var x = null;
x?? 'other value'; // 'other value'
x = 1;
x?? 'other value'; // 1
x = 0.0;
x?? 'other value'; // 0.0
x = NaN;
x??'other value'; //NaN
x ="";
x??'other value'; // ""
{code}

> add ?? operator support 
> ------------------------
>
>                 Key: JEXL-226
>                 URL: https://issues.apache.org/jira/browse/JEXL-226
>             Project: Commons JEXL
>          Issue Type: New Feature
>    Affects Versions: Later
>            Reporter: Min Wei
>              Labels: features
>             Fix For: Later
>
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> Jexl already supports null-coalescing semantics with the operator "?:". So it 
> should be a simple matter to extend it with a different syntax.
> https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/operators/null-conditional-operator
> https://github.com/apache/commons-jexl/pull/4



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

Reply via email to