[
https://issues.apache.org/jira/browse/JEXL-276?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16621530#comment-16621530
]
Dmitri Blinov commented on JEXL-276:
------------------------------------
I agree that clearness depends on the context, but the proposed syntax does not
force anyone to use it; The idea is the same as in {{return;}} vs {{return
null;}} and {{var x;}} vs {{var x = null;}}, e.g. one can omit {{null}} if
desired
> Introduce short-handed ternary operation x ? y
> ----------------------------------------------
>
> Key: JEXL-276
> URL: https://issues.apache.org/jira/browse/JEXL-276
> Project: Commons JEXL
> Issue Type: Improvement
> Affects Versions: 3.1
> Reporter: Dmitri Blinov
> Priority: Minor
>
> A short-handed ternary operation {{x ? y}} is an equivalent of the {{x ? y :
> null}}. The {{x : y}} operator is analogous to {{if (x) y}} statement with
> {{else}} part omitted. With new syntax we will have ternary operator and
> {{if}} statement to have full symmetry of forms, e.g.
> {{x ? y : x}} is {{if (x) y else z}}, {{x ? y}} is {{if (x) y}}
> Just to note, the proposed short-handed differs from Elvis operator {{x ?:
> y}} which is effectively {{x ? x : y}}. In other words, elvis operator allows
> for the middle part of the ternary operator to be omitted, whereas the
> proposed form allows for the imission of the last part.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)