4 ms·
> not the languages's fault. I think that's the whole point. It's not the right tool for their specific goal. In their design doc[0], they agree that Rust glu
by smhmd 6y ago
> not the languages's fault.
I think that's the whole point. It's not the right tool for their specific goal.
In their design doc[0], they agree that Rust glue code should not be written in TS: compiled code "full of weird namespaces."
From the design doc discussion[0]:
ry: manually managing the d.ts files has been great - it's very much part of the public interface - we need to have 100% control over it
we do not want random compiler-generated __namespace0123 in there
This is the same situation - but for the bundle
It's not good that we do not have visibility nor control over what code is in there.
for example, the TS compiler worker, has 15k lines of code in its bundle - EXCLUDING typescript.js
TS compiler worker is about 500 line thing that interfaces between ops and TSC
this is caused by our attempt to "self host" the internal code
self hosting is cute - but if it's effecting performance and the ability to make improvements - it's an unnecessary feature
https://gist.github.com/ry/a6d4b1466158d82750a6447342fd3af4 https://gist.github.com/ry/a6d4b1466158d82750a6447342fd3af4
^--- here is what we ship for the compiler worker
we call this code every time deno runs
lucacasonato: Ok, wow. I hadn't seen this. That changes things...
ry: does the compiler worker really need to generate a UUID? https://gist.github.com/ry/a6d4b1466158d82750a6447342fd3af4#file-compiler_snapshot-js-L9982 https://gist.github.com/ry/a6d4b1466158d82750a6447342fd3af4#...
(no)
yes, this is fixable within the current system .. but the point is that we're abstracting away the important parts
V8 does not run typescript. It runs JS. We need to have a good handle on the JS we ship
If we don't try to self-host, we don't need a sourcemap for the internal code. There's 1mb off the executable right there.
The point is the internal typescript comes at a cost - and that cost is too high.
lucacasonato: So the actual issue is the bundling and opaqueness that that brings with it. It makes sense to stick to pure JS in that case. Its annoying that type checking is gone, but youre right. This is not the kind of code that should be in the runtime.
ry: not like the code isn't full of "!" anyway. TS is great, but it gives a false sense of security.
[0]: https://docs.google.com/document/d/1_WvwHl7BXUPmoiSeD8G83JmS8ypsTPqed4Btkqkn_-4/edit?usp=sharing https://docs.google.com/document/d/1_WvwHl7BXUPmoiSeD8G83JmS...
- ricardobeat 6y agoThe compiled 'mess' that is shipped in the runtime is mostly due to SystemJS, not TypeScript - it doesn't handle modules, and compiles to very clean code if you target a recent ES version. I'm confused as to how dropping TS will help with the code emitted for modules.
- wereHamster 6y agoIs SystemJS still a thing? What's their point now that browsers support ESM natively?
- untog 6y agoDeno != browser
- wereHamster 6y agoI know that. What eludes me is what advantages SystemJS brings over ESM, for browser runtimes and server runtimes (node, deno)…
- untog 6y agoIIRC SystemJS can be used without any transpilation at runtime. ESM cannot (unless natively supported of course, like it is in browsers)
- TheDesolate0 6y agoJavascript just needs to die like flash.