by davman on 7/30/19, 9:30 AM with 398 comments
by mmartinson on 7/30/19, 1:17 PM
If we still need to target es5 4 years later, and transpilation is standard practice, why bother? Is the evolution of JS not directed in practice by the authors of Babel and Typescript? If no one can confidently ship this stuff for years after, what’s the incentive to even bother thinking about what is official vs a Babel supported proposal.
I like the idea of idiomatic JS with powerful modern features, but in practice every project I’ve seen seems to use a pretty arbitrary subset of the language, with different ideas about best practices and what the good parts are.
by halfmatthalfcat on 7/30/19, 11:41 AM
by ojosilva on 7/30/19, 1:53 PM
My idea is that `let`, `var` and `const` return the value(s) being assigned. Basically I miss being able to declare variables in the assertion part of `if` blocks that are scoped only during the `if()` block existence (including `else` blocks).
Something along these lines:
if( let row = await db.findOne() ) {
// row available here
}
// row does not exist here
The current alternative is to declare the variable outside the `if()` block, but I believe that is inelegant and harder to read, and also requires you to start renaming variables (ie. row1, row2...) due them going over their intended scope.As previous art, Golang's:
if x:=foo(); x>50 {
// x is here
}
else {
// x is here too
}
// x is not scoped here
And Perl's if( ( my $x = foo() ) > 50 ) {
print $x
}
by afandian on 7/30/19, 10:18 AM
But I'm still very nervous about some of the stuff mentioned here with regard to mutation. Taking Rust and Clojure as references, you always know for sure whether or not a call to e.g. `flat` will result in a mutation.
In JS, because of past experience, I'd never be completely confident that I wasn't mutating something by mistake. I don't know if you could retrofit features like const or mut. But, speaking personally, it might create enough safety-net to consider JS again.
(Maybe I'm missing an obvious feature?)
by rglover on 7/30/19, 12:38 PM
by chriswwweb on 7/30/19, 11:59 AM
And also here is a good recap of ES 6/7/8/9 (just in case you missed something) (also not mine): https://medium.com/@madasamy/javascript-brief-history-and-ec...
by jeffwass on 7/30/19, 10:45 AM
by NKCSS on 7/30/19, 11:27 AM
by dawhizkid on 7/30/19, 4:16 PM
by namelosw on 7/30/19, 12:04 PM
I really hope there could be syntactic sugar like do expression in Haskell, for in Scala, and LinQ in C# for flatMap instead of type limited version like async await.
Another thing is pipe operator seems to be very welcome among the proposals. There will be no awkward .pipe(map(f), tap(g)) in RxJS since then.
by swalsh on 7/30/19, 11:56 AM
by ahmedfromtunis on 7/30/19, 12:09 PM
by moomin on 7/30/19, 10:26 AM
by jonstaab on 7/30/19, 2:31 PM
by intea on 7/30/19, 12:08 PM
[1,2,,3]
by kuon on 7/30/19, 10:25 AM
I really love languages that force you to handle errors up to the top level.
by zitto on 7/30/19, 12:54 PM
by pier25 on 7/30/19, 7:25 PM
IMO the three features that would make a much more significant impact in front end work are:
- optional static types
- reactivity
- some way to solve data binding with the DOM at the native level
by bitwize on 7/30/19, 2:27 PM
by alexlur on 7/30/19, 11:19 AM
by mhd on 7/30/19, 2:54 PM
by bryanrasmussen on 7/30/19, 3:57 PM
by DonHopkins on 7/30/19, 4:50 PM
by estomagordo on 7/30/19, 10:51 AM
const test = Symbol("Desc");
testSymbol.description; // "Desc"
---------
Should testSymbol be replaced with test?
by Already__Taken on 7/30/19, 10:18 PM
by john-foley on 7/30/19, 10:55 AM
by derefr on 7/30/19, 10:16 AM
by ZenPsycho on 7/30/19, 11:09 AM
by la12 on 7/30/19, 3:50 PM
We go on adding fancy new syntax for little or no gain. The whole arrow function notation, for example, buys nothing new compared to the old notation of writing "function(....){}" other than appearing to keep up with functional fashion of the times.
Similarly, python which was resistant to the idea of 20 ways to do the same thing, also seems to be going in the direction of crazy things like the "walrus" operator which seems to be increasing the cognitive load by being a little more terse while not solving any fundamental issues.
Nothing wrong with functional paradigm, but extra syntax should only be added when it brings something substantial valuable to the table.
Also, features should be removed just as aggressively as they are added, otherwise you end up with C++ where you need less of a programmer to be able to tell what a given expression will do and more of a compiler grammar lawyer who can unmangle the legalese.
by Dirlewanger on 7/30/19, 1:23 PM
by jorangreef on 7/30/19, 2:37 PM
Function.toString being more accurate is helpful.
But real progress would be removing dangerous backtracking regular expressions in favor of RE2: https://github.com/google/re2/wiki/Syntax