[
https://issues.apache.org/jira/browse/JEXL-182?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Terefang Verigorn updated JEXL-182:
-----------------------------------
Description:
common code often has constructs along the lines of:
String r = ((v != null) ? v : "default");
wouldnt this be better handled by a simple operator ?
groovy has "?:" (http://www.groovy-lang.org/operators.html#_elvis_operator)
like:
def r = (v ?: 'default');
and php 7 now has '??'
(http://php.net/manual/en/migration70.new-features.php#migration70.new-features.null-coalesce-op)
like:
$r = ($v ?? 'default');
was:
common code often has constructs along the lines of:
String r = ((v == null) ? v : "default");
wouldnt this be better handled by a simple operator ?
groovy has "?:" (http://www.groovy-lang.org/operators.html#_elvis_operator)
like:
def r = (v ?: 'default');
and php 7 now has '??'
(http://php.net/manual/en/migration70.new-features.php#migration70.new-features.null-coalesce-op)
like:
$r = ($v ?? 'default');
> null coalesce operator
> ----------------------
>
> Key: JEXL-182
> URL: https://issues.apache.org/jira/browse/JEXL-182
> Project: Commons JEXL
> Issue Type: Improvement
> Affects Versions: 2.1.1
> Environment: all
> Reporter: Terefang Verigorn
> Priority: Trivial
> Labels: features
>
> common code often has constructs along the lines of:
> String r = ((v != null) ? v : "default");
> wouldnt this be better handled by a simple operator ?
> groovy has "?:" (http://www.groovy-lang.org/operators.html#_elvis_operator)
> like:
> def r = (v ?: 'default');
> and php 7 now has '??'
> (http://php.net/manual/en/migration70.new-features.php#migration70.new-features.null-coalesce-op)
> like:
> $r = ($v ?? 'default');
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)