3 ms·
> So lets say we get rid of function scope. var no longer serves a purpose, right? Just use a lint rule (eshint or whatever people use these days). Even if var
by klodolph 4y ago
> So lets say we get rid of function scope. var no longer serves a purpose, right?
Just use a lint rule (eshint or whatever people use these days). Even if var serves no purpose in "stricter" mode, removing it also serves no purpose. It's got to remain supported by the underlying implementation for eternity, in all likelihood.
> Fix import keyword ordering
As it is, import binding looks like an assignment,
import { x, y } from "z";
Kind of like:
const { x, y } = require("z");
The consistency is nice.
> Get rid of await soup for most code
Non-starter, because you need to be able to pass around promises as values, without having them explode on you.
> The less wild alternative would be to just make await a postfix keyword.
This is the only proposal here that makes some sort of sense, but the problem here is that in JavaScript, keywords can be used as property names... without quoting. I mean, that's already how promises work:
somePromise.then(x => { ... })
Even though "then" is a keyword, it's a property here, which is fine. Why would the "await" property be special? If it's special, it should have special syntax. In other words,
somePromise.await
This SHOULD be a property access, because that's the syntax for property accesses, even when the property happens to be the name of a keyword. Don't make major breaks to language consistency and introduce weird corner cases just because postfix syntax has some advantages.
> Make object-returning arrow functions cleaner
I don't see how this one can be done in a way that isn't completely horrible. We do need functions that return void. The proposal doesn't show how you can write out a function that returns void here.