4 ms·
I wrote this, and would like to reply to the same comments repeated many times. Preface: I wrote this as a whim, but understand that almost none of this is acc
by rtpg 4y ago
I wrote this, and would like to reply to the same comments repeated many times.
Preface: I wrote this as a whim, but understand that almost none of this is acceptable.
However! People claim these are not merely bad ideas, but not doable at a technical level. This is, to my understanding, false. These are merely bad ideas, but can be implemented!
> This does not make things stricter
True! The name was a bad idea, playing off "strict mode". The main thing was about opting into new behavior.
> let/const/var reshuffling can't work with existing code
This could be done at the tokenizer level. If you have "stricter mode" on the top of the file, you swap out the tokens.
> auto-await cannot work because some non-async functions return promises
A non-async function would simply return the promise value! I am not suggesting removing promises. I am suggesting that when a call to an async function happens from within another async function (async function being defined via syntax, not by return value!), at runtime, we insert the await (with an escape hatch via asPromise). This does not require solving the halting problem, and is merely extremely confusing and hard to explain and probably gets in the way of a lot of JITing efforts.
> name => {name} is not possible at a parsing level
It's possible! But it involves breaking the parse results of existing code. Python recently introduced changes that required more complicated parsers than before, and this would also be of a similar quality. Some recursive descent backtracking parser that simply tries to parse as an object literal, and if that fails backtrack would solve the requirement. Perhaps a well-thought out grammar could make this work without backtracking, but I would be surprised.
> foo.await is not possible
This is such a weird one to me. Rust has this! I am not saying "if an object lookup is for the key of await then do an await", but "if foo.await is in your actual code then that is the same as (await foo)". There's a difference between modifying syntax and modifying semantics, and I was proposing modifying of syntax, not object lookup semantics.