JavaScript (even with TypeScript) is the most "pit of despair" language I have had the displeasure of working in. I've gone from working on embedded C, to Dart + Flutter (desktop/mobile apps), to now building desktop/CLI apps with TypeScript along with their corresponding packages for interfacing with hardware (mostly custom hardware, some off the shelf).
To give credit where it's due, I think the FFI works well with Koffi [1]. And it's nice that Node.js has the ability to run `.ts` directly (erasableSyntaxOnly). TypeScript's type system is also really good! Apart from what arguably should be the basics? Nothing has been easy. Unlike Dart which seemed heavily biased towards falling into the pit of success [2], the JS ecosystem seems to be a chasm of despair that is almost unavoidable, even with a huge amount of work (and indeed, billions of dollars has gone into this chasm). In the last three months I've run into friction in:
- Dependency resolution. Why can you have multiple copies of the same package with different versions??? Just print a dependency resolution error. That's what Dart does, and I imagine it's part of why the dependency culture isn't anywhere near as bad over there.
- Packaging & Lifecycle script semantics.
- Semver with monorepos + `git:` dependencies. npm and yarn will resolve semver ranges for the repo using git tags like `v1.0.2`, but they won't consider tags of the form `my-packagev1.0.2`. So if you want monorepo productivity + semver range resolution you must publish to a private registry or "publish" from the monorepo to a dedicated mirror repo for each package.
- The Linter + Formatter. Prettier destroys any sense of stylistic intent and you can't "communicate" with it (add/remove a single comma to express a single line vs multi-line formatting choice), so I've had to resort to using ESLint as a joint formatter [3] + linter.
- Using TS/JS as a _scripting_ language. Lengthy `npx` shebangs ensue since my users NEED my library to have anything worth scripting. Either that or you pay the `package.json`, `node_modules`, `.yarnrc.yml`, `tsconfig.json`, etc. tax (did I mention that there are just WAY too many config files?) Seems like it's an every day occurrence that I run into issues that Dart/Zig/Rust would've simply just not had, or if they did then they would have handled it superbly. And here I was thinking JS's bloat was supposed to be excused by the convenience it offered! Don't use JS/TS unless you absolutely need to run in a browser. And like unkernel shows, maybe you can just write native apps and ignore JS all together. [1] https://koffi.dev/
[2] https://blog.codinghorror.com/falling-into-the-pit-of-succes...
[3] https://eslint.style/
Insanity, n.: having perfectly good, fast, stable, well-documented, well-designed, widely-supported programming languages, and throwing them away to instead reinvent the wheel in the form of a toy language created to make pop-ups in a hypertext document viewer
Comments (374) 58 threads
Earlier commentsTo give credit where it's due, I think the FFI works well with Koffi [1]. And it's nice that Node.js has the ability to run `.ts` directly (erasableSyntaxOnly). TypeScript's type system is also really good!
Apart from what arguably should be the basics? Nothing has been easy. Unlike Dart which seemed heavily biased towards falling into the pit of success [2], the JS ecosystem seems to be a chasm of despair that is almost unavoidable, even with a huge amount of work (and indeed, billions of dollars has gone into this chasm). In the last three months I've run into friction in: - Dependency resolution. Why can you have multiple copies of the same package with different versions??? Just print a dependency resolution error. That's what Dart does, and I imagine it's part of why the dependency culture isn't anywhere near as bad over there. - Packaging & Lifecycle script semantics. - Semver with monorepos + `git:` dependencies. npm and yarn will resolve semver ranges for the repo using git tags like `v1.0.2`, but they won't consider tags of the form `my-packagev1.0.2`. So if you want monorepo productivity + semver range resolution you must publish to a private registry or "publish" from the monorepo to a dedicated mirror repo for each package. - The Linter + Formatter. Prettier destroys any sense of stylistic intent and you can't "communicate" with it (add/remove a single comma to express a single line vs multi-line formatting choice), so I've had to resort to using ESLint as a joint formatter [3] + linter. - Using TS/JS as a _scripting_ language. Lengthy `npx` shebangs ensue since my users NEED my library to have anything worth scripting. Either that or you pay the `package.json`, `node_modules`, `.yarnrc.yml`, `tsconfig.json`, etc. tax (did I mention that there are just WAY too many config files?)
Seems like it's an every day occurrence that I run into issues that Dart/Zig/Rust would've simply just not had, or if they did then they would have handled it superbly. And here I was thinking JS's bloat was supposed to be excused by the convenience it offered!
Don't use JS/TS unless you absolutely need to run in a browser. And like unkernel shows, maybe you can just write native apps and ignore JS all together.
[1] https://koffi.dev/ [2] https://blog.codinghorror.com/falling-into-the-pit-of-succes... [3] https://eslint.style/
https://bellard.org/jslinux/
All comments shown.
Couldn't load more comments. Check your connection and try again.