this post was submitted on 04 Jun 2025
1003 points (98.5% liked)
Programmer Humor
23795 readers
2687 users here now
Welcome to Programmer Humor!
This is a place where you can post jokes, memes, humor, etc. related to programming!
For sharing awful code theres also Programming Horror.
Rules
- Keep content in english
- No advertisements
- Posts must be related to programming or programmer topics
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Instead of trying to make it work, javascript could just say "error." Being untyped doesn't mean you can't have error messages.
I think it's less about type system, and more about lack of a separate compilation step.
With a compilation step, you can have error messages that developers see, but users don't. (Hopefully, these errors enable the developers to reduce the errors that users see, and just generally improve the UX, but that's NOT guaranteed.)
Without a compilation step, you have to assign some semantics to whatever random source string your interpreter gets. And, while you can certainly make that an error, that would rarely be helpful for the user. JS instead made the choice to, as much as possible, avoid error semantics in favor of silent coercions, conversions, and conflations in order to make every attempt to not "error-out" on the user.
It would be a very painful decade indeed to now change the semantics for some JS source text.
Purescript is a great option. Typescript is okay. You could also introduce a JS-to-JS "compilation" step that DID reject (or at least warn the developer) for source text that "should" be given an error semantic, but I don't know an "off-the-shelf" approach for that -- other than JSLint.
This is fair enough from an idealistic view. In practice, you don't want your entire website to shit itself because of a potentially insignificant error.
This is exactly why it should throw an error, to make it incredibly obvious something isn't working correctly so it can be fixed. Otherwise you have wrong logic leading to hard to notice and hard to debug problems in your code
Use typescript
No. I don't want to transpile. I don't want a bundle. I want a simple site that works in the browser. I want to serve it as a static site. I don't want a build step. I don't want node_modules. I want to code using the language targeted for the platform without any other nonsense.
Javascript is cancer. Fucking left pad?! How the fuck did we let that happen? What is this insane fucking compulsion to have libraries for two lines of code? To need configuration after configuration just to run fucking hello world with types and linting?
No, fuck Typescript. Microsoft owns enough. They own where you store your code. They own your IDE. They might own your operating system. Too much in one place. They don't need to own the language I use, too.
"Let's use a proprietary improvement to fix the standard that should have not sucked in the first place" is why we can't have nice things.
No.
I'd rather have my website shit itself than have silent difficult to find errors.
Use typescript
In practice runtime errors are a bitch to find and fix.
Fair enough. This is why people prefer typescript
Look! I bought this for free on capybaras website, there's a glitch!
capybara: at least it didn't throw an error.
/ jk 😁
Use typescript if you're paranoid about this