3 ms·
I'm more and more thinking that JS is heading in the wrong direction. I'd opt for splitting up JS into two; one is a low level compilation target, something lik
by Cthulhu_ 5y ago
I'm more and more thinking that JS is heading in the wrong direction. I'd opt for splitting up JS into two; one is a low level compilation target, something like... I forgot the name now, it was a subset of JS with hints in comments that allowed the interpreter to forego certain checks (mostly around the dynamic nature of e.g. objects) for speed, I believe this predated WASM and co.
Anyway, a simple version of JS or more like bytecode. Then developers can pick whichever language they want. Because these type annotations do not benefit execution, only development.
- assbuttbuttass 5y agoIsn't WASM basically this low level compilation target you're talking about?
- xmorse 5y agoBefore wasm there was asm.js [0] [0] https://en.wikipedia.org/wiki/Asm.js https://en.wikipedia.org/wiki/Asm.js
- leodriesch 5y agoI’d say WASM is the low level compilation target for JavaScript runtimes. There is also a proposal for directly shipping ASTs instead of JavaScript source files for performance improvements [0]. [0]: https://github.com/tc39/proposal-binary-ast https://github.com/tc39/proposal-binary-ast
- nerdponx 5y ago> Because these type annotations do not benefit execution, only development. Well this is why TypeScript was invented in the first place. Not to mention that "static-only" type annotations are being adopted in Python and Ruby as well. Clearly a lot of developers see a lot of value in them.
- isaacimagine 5y agoYou're thinking of asm.js: http://asmjs.org/faq.html http://asmjs.org/faq.html
- mlajtos 5y ago> I forgot the name now, it was a subset of JS with hints in comments that allowed the interpreter to forego certain checks (mostly around the dynamic nature of e.g. objects) for speed, I believe this predated WASM and co. You probably mean asm.js
- tekkk 5y agoNo, it's the right way. TS is the future of the language. Besides JS is not sane enough to be a low level language. WASM is precisely that.
- cphoover 5y agoThen use TS if you prefer. There are plenty of people who prefer languages like that are type-less, and are plenty proficient in it. If you want a strongly-typed static language, compile to a wasm target with typescript, or another language... That's what it there for.
- tekkk 5y agoSure there is but I suppose majority are moving towards typed languages. Perhaps it's sad for some, but it's no fun having to guess types or console.log them because it's just not obvious. Good riddance I say. I'd rather have a proper type-less functional language and it's impossible to create that from JS with its legacy baggage.
- cphoover 5y agoThought experiment If you could go back in time and replace Brendon Eich when he first created JS what would you propose?
- tekkk 5y agoJust ask him to make it more consistent and explain that people will one day create really big apps with the language. Not just little interactive widgets. And design the language from the point of view. Simpler and more scalable. Like having the optional types as proposed here.
- Spivak 5y agoWould you make the same argument if Chrome decided to flip the script and make TS the default browser language and if you wanted something untyped you had to use a compiler?