elvis pattern refinement (was Syntax patterns)
Stephen Colebourne
scolebourne at joda.org
Fri Apr 24 10:28:33 PDT 2009
2009/4/24 Ruslan Shevchenko <rssh at gradsoft.com.ua>:
> But let's return to original question:
>
> is 'safe-method call': i. e. optimization of pattern
> (a==null ? b : a.method(...))
> // Which can be rewritten as
> a?.method() ?: b
> using operators, defined in elvis, can be counted as entry for
> optimization as result of elvis proposal, or not ?
This could be coded as
a?.method() ?: b
however, that would be semantically different in meaning (as now b is
returned if method() returns null, which wasn't originally the case)
Thus, this construct is invalid for Elvis, Null-safe and the
combination of the two.
Stephen
More information about the coin-dev
mailing list