map { some_condition ? $_ : some_default } some_expression;
Very good argument!
The syntax and operand order is confusingly dissimilar to the exiting ternary operator.
Pointless argument: why should it be similar to it? And how is that confusing? It's nonconfusingly similar to C<||> and C<//>. OTOH, while I cherish your map solution, which probably is actually the best one in 5's realms, if you look at it as a whole, it is confusingly dissimilar from those operators, with the value being inspected on the extreme right and the default buried in the block, not to talk of an "unnecessary" C<? $_ :. The right comparison if I get it right should be between:
map { some_condition ?? $_ !! some_default }, some_expression; # and some_expression ||| { some_condition }, some_default;
In reply to Re^2: [Perl 6] Generalized shortcutting C<||>?
by blazar
in thread [Perl 6] Generalized shortcutting C<||>?
by blazar
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |