Most active commenters
  • williamcotton(6)
  • epolanski(5)
  • Xelbair(4)
  • zachrip(3)

←back to thread

1208 points jamesberthoty | 57 comments | | HN request time: 2.349s | source | bottom
1. jbd0 ◴[] No.45260954[source]
I knew npm was a train wreck when I first used it years ago and it pulled in literally hundreds of dependencies for a simple app. I avoid anything that uses it like the plague.
replies(3): >>45260975 #>>45261085 #>>45261124 #
2. oVerde ◴[] No.45260975[source]
So basically you live JavaScript free?
replies(4): >>45260998 #>>45261034 #>>45261487 #>>45261734 #
3. Arch-TK ◴[] No.45260998[source]
I mean, it's hard to avoid indirectly using things that use npm, e.g. websites or whatever. But it's pretty easy to never have to run npm on your local machine, yes.
4. Xelbair ◴[] No.45261034[source]
as much as i can yes.

I try to avoid JS, as it is a horrible language, by design. That does include TS, but it at least is useable, but barely - because it still tied to JS itself.

replies(3): >>45261071 #>>45261213 #>>45261604 #
5. diggan ◴[] No.45261071{3}[source]
Off-topic, but I love how different programmers think about things, and how nothing really is "correct" or "incorrect". Started thinking about it because for me it's the opposite, JS is an OK and at least usable language, as long as you avoid TS and all that comes with it.

Still, even I who'd call myself a JavaScript developer also try to avoid desktop applications made with just JS :)

replies(2): >>45261241 #>>45262323 #
6. zachrip ◴[] No.45261085[source]
I can tell a lot about a dev by the fact that they single out npm/js for this supply chain issue.
replies(7): >>45261191 #>>45261219 #>>45261232 #>>45261237 #>>45261268 #>>45261512 #>>45263231 #
7. epolanski ◴[] No.45261124[source]
"I knew you weren't a great engineer the moment you started pulling dependencies for a simple app"

You realize my point right? People are taught to not reinvent the wheel at work (mostly for good reasons) so that's what they do, me and you included.

You ain't gonna be bothered to write html and manual manipulation, the people that will give you libraries to do so won't be bothered reimplementing parsers and file watchers, file watcher writers won't be bothered reimplementing file system utils, file system utils developers won't be bothered reimplementing structured cloning or event loops, etc, etc.

I myself just the other day had the task of converting HTML to markdown, because I don't remember whether it was Jira or Github APIs that returns comments as HTML and despite it being mostly few hours of work that would get us 90% there everybody was in favor of pulling a dependency to do so (with its own dependencies) and thus further exposing our application to those risks.

replies(1): >>45261333 #
8. hsbauauvhabzb ◴[] No.45261191[source]
That they’ve coded in more than one language?
9. kaiomagalhaes ◴[] No.45261213{3}[source]
out of sincere curiosity, which one is a great programming language to you?
replies(1): >>45261350 #
10. ◴[] No.45261219[source]
11. brobdingnagians ◴[] No.45261232[source]
Lots of languages ecosystems have this problem, but it is especially prominent in JS and lies on a spectrum. For comparison, in the C/C++ ecosystem it is prominent to have libraries advertising that they have zero dependencies and header only or one common major library like Boost.
12. RUnconcerned ◴[] No.45261237[source]
What other language ecosystems have had this happen systematically? This isn't even the first time this month!
replies(5): >>45262049 #>>45262513 #>>45265664 #>>45267928 #>>45271328 #
13. Xelbair ◴[] No.45261241{4}[source]
JS's issue is that it allows you to run an objectively wrong code without throwing explicit error to the user, it just fails silently or does something magical. Seems innocent, until you realize what we use JS for, other than silly websites or ERP dashboards.

It is full of gotchas that serves 0 purpose nowadays.

Also remember that it is basically a Lisp wearing Java skin on top, originally designed in less than 2 weeks.

Typescript is one of few things that puts safety barrier and sane static error checking that makes JS bearable to use - but it still has to fall down to how JS works in the end so it suffers from same core architectural problems.

replies(1): >>45261314 #
14. lithos ◴[] No.45261268[source]
Just more engineering leaning than you. Actual engineers have to analyze their supply chains, and so makes sense they would be baffled by NPM dependency trees that utterly normal projects grow into in the JavaScript ecosystem.
replies(2): >>45261475 #>>45265112 #
15. diggan ◴[] No.45261314{5}[source]
> JS's issue is that it allows you to run an objectively wrong code without throwing explicit error to the user, it just fails silently or does something magical. Seems innocent, until you realize what we use JS for, other than silly websites or ERP dashboards.

What some people see as a fault, others see as a feature :) For me, that's there to prevent entire websites from breaking because some small widget in the bottom right corner breaks, for example. Rather than stopping the entire runtime, it just surfaces that error in the developer tools, but lets the rest to continue working.

Then of course entire web apps crash because one tiny error somewhere (remember seeing a blank page with just some short error text in black in the middle? Those), but that doesn't mean that's the best way of doing things.

> Also remember that it is basically a Lisp wearing Java skin on top

I guess that's why I like it better than TS, that tries to move it away from that. I mainly do Clojure development day-to-day, and static types hardly ever gives me more "safety" than other approaches do. But again, what I do isn't more "correct" than what anyone else does, it's largely based on "It's better for me to program this way".

replies(2): >>45261377 #>>45272105 #
16. komali2 ◴[] No.45261333[source]
Pause, you could write an HTML to markdown library in half a day? Like, 4 hours? Or 12? Either way damn
replies(1): >>45261344 #
17. epolanski ◴[] No.45261344{3}[source]
One that gets me 90% there would take me few hours, one that gets me 99% there few months, which is why eventually people would rather pull a dependency.
replies(1): >>45261442 #
18. Xelbair ◴[] No.45261350{4}[source]
depends on use case, i don't think one language can fit all cases. 100% correctness is required for systems, but it is a hindrance in non-critical systems. or robust type systems require high compilation times which hurt iterating on the codebase.

systems? rust - but it is still far from perfect, too much focus on saving few keystrokes here and there.

general purpose corporate development? c# - despite current direction post .net 5 of stapling together legacy parts of .net framework to .net core. it does most things good enough.

scripting, and just scripting? python.

web? there's only one, bad, option and that's js/ts.

most hated ones are in order: js, go, c++, python.

go is extremely infuriating, there was a submission on HN that perfectly encapsulated my feelings about it, after writing it for a while: https://fasterthanli.me/articles/i-want-off-mr-golangs-wild-...

replies(1): >>45262561 #
19. Xelbair ◴[] No.45261377{6}[source]
>it's there to prevent entire websites from breaking because some small widget in the bottom right corner breaks, for example.

the issue is that it prevents that, but also allows you to send complete corrupt data forward, that can create horrible cascade of errors down the pipeline - because other components made assumption about correctness of data passed to them.

Such display errors should be caught early in development, should be tested, and should never reach prod, instead of being swept under the rug - for anything else other than prototype.

but i agree - going fully functional with dynamic types beats average JS experience any day. It is just piling up more mud upon giant mudball,

20. williamcotton ◴[] No.45261442{4}[source]
Or about 15 minutes with an LLM?

https://github.com/williamcotton/markdown-to-html-llm

  ;)
replies(2): >>45261661 #>>45262461 #
21. zachrip ◴[] No.45261475{3}[source]
Do you think companies using node don't analyze supply chains? That's nonsense. Have you cargo installed a rust app recently? This isn't just a js issue. This needs to be solved across the industry and npm frankly has done a horrible job at it. We let people with billions of downloads a month with recently changed password/2fa publish packages? Why don't we pool assets as a collective to scan newly published packages before they're allowed to be installed? These types of things really should exist across all package registries (and my really hot take is that we probably don't need a registry for every language, either!).
replies(3): >>45262860 #>>45262989 #>>45269609 #
22. shkkmo ◴[] No.45261487[source]
You can write javascript without using npm...
23. Aeolun ◴[] No.45261512[source]
I think it’s just that a lot of old men don’t like how popular it has become with script kiddies.
24. hoppp ◴[] No.45261604{3}[source]
Lucky you. I keep coming back to it because jobs and even for desktop apps a native webview beats everything else.

We fcked up with js, big time and its with us forever now

replies(3): >>45261698 #>>45261995 #>>45281955 #
25. neilv ◴[] No.45261661{5}[source]
In less time than that, you could `git clone` the desired open source package, and text search & replace the author's name with your own.
replies(1): >>45261742 #
26. koakuma-chan ◴[] No.45261698{4}[source]
For game dev too - all game engines suck. <canvas/> FTW.
27. ◴[] No.45261734[source]
28. williamcotton ◴[] No.45261742{6}[source]
And then still be subject to supply-chain attacks with all of the dependencies in whatever open source package you're cloning?
replies(1): >>45263358 #
29. sfn42 ◴[] No.45261995{4}[source]
I was hyped for wasm because i thought it was supposed to solve this problem, allowing any programming language to be compiled to run in browsers.

But apparently they only made it do like 95% of what JS does so you can't actually replace js with it. To me it seems like a huge blunder. I don't give a crap about making niche applications a bit faster, but freeing the web from the curse of JS would be absolutely huge. And they basically did it except not quite. It's so strange to me, why not just go the extra 5%?

replies(3): >>45262081 #>>45265200 #>>45272185 #
30. blueflow ◴[] No.45262049{3}[source]
Python/PyPi.
31. hoppp ◴[] No.45262081{5}[source]
Maybe its something about sharing memory with the js that would introduce serious vulnerabilities so they can't let wasm code have access to everything.

The only way to remove Js is to create a new browser that doesn't use it. Fragments the web, yes and probably nobody will use it

32. eitland ◴[] No.45262323{4}[source]
> JS is an OK and at least usable language, as long as you avoid TS and all that comes with it.

Care to explain why?

My view is this: since you can write plain JS inside TS (just misconfigure tsconfig badly enough), I honestly don’t see how you arrive at that conclusion.

I can just about understand preferring JS on the grounds that it runs without a compile step. But I’ve never seen a convincing explanation of why the language itself is supposedly better.

33. epolanski ◴[] No.45262461{5}[source]
I love how it took you very short to implement...the wrong thing.

> I myself just the other day had the task of converting HTML to markdown

> you could write an HTML to markdown library in half a day

replies(1): >>45262539 #
34. johnisgood ◴[] No.45262513{3}[source]
Rust.
35. williamcotton ◴[] No.45262539{6}[source]
LOL! Good point, my friend.
replies(1): >>45262940 #
36. johnisgood ◴[] No.45262561{5}[source]
Under a submission like this you picked Rust, that is neat.
37. LaGrange ◴[] No.45262860{4}[source]
> Do you think companies using node don't analyze supply chains?

I _know_ many don’t. In fact suggesting doing it is a good way to be looked at like a crazy person and be told something like “this is a yes place not a no place.”

38. williamcotton ◴[] No.45262940{7}[source]
Claude Code just added support for HTML to Markdown. Seems to work?
replies(1): >>45263201 #
39. pclmulqdq ◴[] No.45262989{4}[source]
It is solved across the industry for those who care. If you use cargo, npm, or a python package manager, you may have a service that handles static versioning of dependencies for security purposes. If you don't, you aren't generally working in a language that encourages so much package use.
40. epolanski ◴[] No.45263201{8}[source]
In any case, not following the point you're trying to make.
replies(1): >>45263450 #
41. cedws ◴[] No.45263231[source]
The JavaScript ecosystem has a major case of import-everything disease that acts as a catalyst for supply chain attacks. left-pad as one example of many.
42. xrisk ◴[] No.45263358{7}[source]
you are aware that the app you just wrote with Claude pulls in dependencies, yes?
replies(1): >>45263478 #
43. williamcotton ◴[] No.45263450{9}[source]
LLMs are pretty good at greenfield projects and especially if they are tasked with writing something with a lot of examples in the training data. This approach can be used to solve the problem of supply-chain attacks with the downside being that the code might not be as well written and feature complete as a third-party package.
replies(1): >>45265192 #
44. williamcotton ◴[] No.45263478{8}[source]
Not for the parser, only for the demo server! And I guess the dev dependencies as well, but with a much smaller surface area. But yeah, I don't think a TypeScript compiler is within the scope of an LLM.
45. Lumping6371 ◴[] No.45265112{3}[source]
Good thing that at scale, private package repositories or even in-house development is done. Personally, I would argue that an engineer unable to tell apart perfect from good, isn't a very good engineer in my book, but some engineers are unable to make compromises.
46. epolanski ◴[] No.45265192{10}[source]
I use LLMs too, but don't share your opinion fully.
47. lyu07282 ◴[] No.45265200{5}[source]
That 5% of js glue code necessary right now is just monumentally difficult to get rid of, it's like a binary serialization / interface (ABI) of all DOM/BOM APIs and these APIs are huge, dynamic, callback-heavy and object-oriented. It's much easier to have that glue compiler generated, which you can already do right now (you can write your entire web app in rust if you want):

https://github.com/wasm-bindgen/wasm-bindgen https://docs.rs/web-sys/latest/web_sys/

This is also being worked on, in the future this 5% glue might eventually entirely disappear:

> Designed with the "Web IDL bindings" proposal in mind. Eventually, there won't be any JavaScript shims between Rust-generated wasm functions and native DOM methods

48. LPisGood ◴[] No.45265664{3}[source]
Go has this issue
49. SkyPuncher ◴[] No.45267928{3}[source]
NPM is the most popular, so it happens the most frequently. All of the other ecosystems are just as susceptible.

Unix had a big scare last year because of XZ Utils.

https://en.wikipedia.org/wiki/XZ_Utils_backdoor

replies(1): >>45273588 #
50. keyle ◴[] No.45269609{4}[source]
2FA would certainly help, however you'd still have malware like these silently updating code and waiting for the next release.

We'd have to rely on the developer to notice, and check every line of code they ship, which might be the norm but certainly not 100% of cases.

51. mdavidn ◴[] No.45271328{3}[source]
RubyGems is susceptible too.
52. joquarky ◴[] No.45272105{6}[source]
IME, JSDoc is sufficient for type checking.

TS is just too much overhead for the marginal gains.

53. joquarky ◴[] No.45272185{5}[source]
The DOM is fundamentally dependent upon JS shaped data structures and garbage collection. They are BFFs.

Any attempt to bypass this will be perilous.

replies(1): >>45272397 #
54. sfn42 ◴[] No.45272397{6}[source]
So we'd need a new DOM, seems feasible
55. Sankozi ◴[] No.45273588{4}[source]
No they are not as susceptible - auto updating dependencies, post install scripts and culture of thousands of crappy micro packages (like left-pad) is mainly a NPM issue.
replies(1): >>45275554 #
56. zachrip ◴[] No.45275554{5}[source]
Packages are not auto updated if you have a package-lock. Agreed that post-install, left-pad, etc have been overall problematic tho.
57. bigstrat2003 ◴[] No.45281955{4}[source]
A webview doesn't beat anything for desktop apps. It is the worst option available.