3 ms·
This is great news! And a nice working demo ... And a general question about wasm - since typescript can be strictly typed, would it benefit much, if it would b
by hutzlibu 11y ago
This is great news! And a nice working demo ...
And a general question about wasm - since typescript can be strictly typed, would it benefit much, if it would be compiled to wasm?
- CyberDildonics 11y agoI think you would want to see how it does when compiled to LLVM IR to answer that question. Also keep in mind that webasm doesn't include a garbage collector. If typescript relies on one, it will need to be compiled to webasm as well.
- hutzlibu 11y agoAh right, the gc. I doubt you will see much benefit, if you will have to compile him as well. But maybe it is possible to code without ... and free memory yourself with "delete x" or "x=null"
- constexpr 11y agoI currently write compilers that target JavaScript and have looked a TypeScript a lot for something like this. In practice, TypeScript isn't actually strictly typed. There is a ton of TypeScript code out there that does stuff like run-time prototype manipulation (mixins, for example), using arbitrary objects as hash tables, and liberal use of the "any" type. So either you cross-compile a JavaScript VM to be able to handle everything (super slow and bloated, especially without the ability to JIT compile executable code) or you pick a small subset of TypeScript to compile, in which case it wouldn't really be TypeScript at all. Plus TypeScript doesn't have integer types (only doubles) so it would generate pretty inefficient code. JavaScript JITs do a lot of work to turn usage of doubles into integers based on run-time behavior that is unknowable at compile-time.
- hutzlibu 11y agoI think I would be happy with the subset and the add of Integers ... Dynamic languages are great for rapid prototyping and debugging, but once the programming is done and everything is clear, I don't realy need stuff like window["foo" + someString](1,2,3) or the "any" type anymore ... I don't think it will be too hard, to "strongtype" your ts or js if there will be such a subset and you have a smart IDE.