Re:Comparing the Same Project in Rust, Haskell, C++, Python,...
by lyjackal on Saturday June 15, 2019 @08:51PM
(#20193144)
Usually it's awful. I wish JavaScript had if else expressions. Sometimes it can help to break up the lines with indents if you need a single expression:
[ Parent
| on HN ]
Re:Comparing the Same Project in Rust, Haskell, C++, Python,...
by _jsdw on Sunday June 16, 2019 @03:08AM
(#20194245)
I settled on this a while ago which I think is perfectly readable:
const myvar
= foo < bar ? bar
: bar < baz ? baz
: lark < 10 ? lark
: 0
Re:Comparing the Same Project in Rust, Haskell, C++, Python,...
by Avi-D-coder on Sunday June 16, 2019 @04:04AM
(#20194413)
Your wish can come true. Take a look at this stage 1 of the TC39 proposal.
https://github.com/tc39/proposal-do-expressions