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-226) add ?? operator support
Date Tue, 27 Jun 2017 10:29:00 GMT

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

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

Aliases we have (eq, etc...) are witnesses of a long past; I wish there was an easy way to
deprecate them...

Back to null coalescing, after carefully reviewing the various semantics associated with '?:'
and '??', it might be worth adding an actual strict 'null coalescing' operator. It would only
return the right hand side if the left hand side is null (or undefined for a variable). The
difference would be as such:
{code}
var a = false;
a ?? 'other value'  ; // returns false
a ?: 'other value' ; // returns 'other value'
var b = 0;
b ?? 'other value'  ; // returns 0
b ?: 'other value' ; // returns '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)

Mime
View raw message