4 ms·
I get using plain JS, but JS's lack of expression-statements (see rust for contrast) just makes most of it EXTREMELY awkward. Ternaries, booleans that cast to
by the_gipsy 3y ago
I get using plain JS, but JS's lack of expression-statements (see rust for contrast) just makes most of it EXTREMELY awkward.
Ternaries, booleans that cast to JSX, switch statements wrapped in IIFs...
- hajile 3y agoThe crazy part is that there's not a really good reason why we couldn't make if..else function as either a statement or expression depending on the context. I think there's a proposal to do that.
- bafe 3y agoIndeed, at least there's a TC39 proposal for that. It should be the default for all statements and it's shocking that python went to define the new match clause to be just a statement and not an expression
- bafe 3y agoOnce you try any languages where (almost) anything is an expression, it is hard to accept statement-oriented languages
- the_gipsy 3y agoThat's true. But in JSX you have the extra constraint that you can't really use imperative code so this magnifies even more.
- bafe 3y agoIndeed, having if-then-else being an expression (as well as switch) would be great in JSX. It seems there's a proposal for a match expression in TC39...