I think you’re correct that, if the language formally adopted types, it would look similar to TypeScript. How _much_ of TS would be mirrored may be a different story - it’s incredibly extensive in some areas, I’m still learning new things about it as I’ve only recently started getting into it for work, and there’s a lot to it beyond basic type support.
Forget runtime type validation, TS is really for preventing bugs at development time as well as IDE integration.
Adding types to javascript proper would be fantastic.
Are you sure? In my understanding modern JS engines basically makes type inference on the code anyway, and in the rare case when types are observed to change at runtime, it is special-cased. So static types might simplify this but I dont see how it would dramatically improve performance.
That said I really doubt JS will actually get sound static types ever. Typescript is not sound.
At least typescript discourage writing functions where the parameters can have wildly different types since this is un-ergonomic and/or hard to type.
It is too much of a drag on productivity using less featureful developer tools, and JavaScript is already plenty fast enough. WASM is good for things that need to be as fast as possible, but for the vast majority of use cases it simply doesn’t offer any benefits.
The advantage of JS is that the browser is aware of your object graph and can provide dev tools around that.
The JIT in V8 and others is pretty solid.
For example, you can’t have a REPL and high-level debugger combo, you just get a very basic low-level debugger. It’s a 90s debugging experience.
You can’t even have a modern low-level debugger because you can’t control how the browser executes your WASM, unlike in a native executable where you can run a debugger and then run your code inside it.
I guess you could have a WASM based debugger that has a WASM interpreter inside, and then you run your code inside that, but my God if that’s the future then I want no part of it.
i would've thought that WASM was really only "good" for reusing existing software written in other languages not intended for the web, by recompiling it into WASM.
For example, you want to create a web version of an app written with QT or some other widgeting framework which could get a WASM target.
I think the plan was to compile to WASM. The hype phase seems to be over, but afaict it’s been delivering on at least some of it’s promises no?