Most active commenters
  • cies(5)
  • leptons(5)
  • regularfry(4)
  • (3)
  • elashri(3)

←back to thread

272 points abdisalan | 53 comments | | HN request time: 0.002s | source | bottom
Show context
mvkel ◴[] No.42175730[source]
> time to run it after not touching it for 4 years

> Two hours of my life gone...

Two hours of work after 4 years sounds ... perfectly acceptable?

And it would have run perfectly right away if the node version was specified, so a good learning, too

This feels like making a mountain out of a mole hill

replies(21): >>42175799 #>>42175818 #>>42175826 #>>42175846 #>>42176217 #>>42176305 #>>42176788 #>>42176958 #>>42181497 #>>42182299 #>>42182564 #>>42182778 #>>42183020 #>>42183093 #>>42183501 #>>42183725 #>>42184814 #>>42192770 #>>42193606 #>>42194518 #>>42211558 #
1. fourseventy ◴[] No.42176305[source]
Sounds like you are way too used to the javascript ecosystem if you think getting an old project to build should take hours...
replies(4): >>42176343 #>>42176528 #>>42185263 #>>42185292 #
2. viraptor ◴[] No.42176343[source]
This is not even JS specific. All of Python / Ruby / other changing runtimes will require some upkeep. Even C recently needs some attention because clang updated default errors.
replies(2): >>42176394 #>>42177183 #
3. Macha ◴[] No.42176394[source]
Even some of my Rust projects end up in this state, where updating one library ends up with needing to update interacting libraries.
replies(1): >>42187920 #
4. Ameo ◴[] No.42176528[source]
What ecosystem are you comparing to?

Any C/C++ project with even mild complexity has a good chance of being extremely difficult to build due to either missing libraries that have to be installed manually, system incompatibilities, or compiler issues.

Python has like 28 competing package managers and install options, half of which are deprecated or incompatible. I can't even run `pip install` at all anymore on Debian.

Even Rust, which is usually great and has modern packaging and built-in dependency management, often has issues building old projects due to breaking changes to the compiler.

All this is to try to say that I don't think this is some problem unique to JS at all - but rather a side effect of complex interconnected systems that change often.

A big reason Docker and containers in general became so popular was because it makes this problem a lot less difficult by bundling much of the environment into the container, and Docker is very much agnostic to the language and ecosystem running inside it.

replies(6): >>42178164 #>>42179805 #>>42180587 #>>42181310 #>>42184179 #>>42191776 #
5. ◴[] No.42177183[source]
6. ramon156 ◴[] No.42178164[source]
Libraries in the project fixes this whole issue for C/C++. As for compiler issues, just run it with the same compiler. It really shouldn't take more than 20 mins of setup.
replies(1): >>42181244 #
7. elashri ◴[] No.42179805[source]
You can't use 'pip install' in debian because they chose to do that during the transition from python2 to python3. You should use 'pip3 install' which is provided by package python3-pip from debian.

One can argue that this decision should be revised by debian but you should not install packages on system python installation for working into projects. Always use virtual environment.

replies(1): >>42180222 #
8. Ameo ◴[] No.42180222{3}[source]
No that does not work either. You get an error like this:

» pip3 install supervisor error: externally-managed-environment

× This environment is externally managed ╰─> To install Python packages system-wide, try apt install python3-xyz, where xyz is the package you are trying to install.

As far as I can understand, they did this on purpose to dissuade users from installing packages globally to avoid conflicts with other Python environments.

Anyway, I'm not trying to argue about if that decision is right or not - I just wanted to use it as an example for my case that the JS ecosystem isn't alone and may even be far from the worst when it comes to this kind of issue.

replies(3): >>42181070 #>>42181259 #>>42184227 #
9. treflop ◴[] No.42180587[source]
Java has a great ecosystem. It’s well thought out and I can compile and run 10 year old projects no problem. In fact, I wish everyone had just copied Java’s model instead of inventing their own worse model.

I love Python but it has a terrible package ecosystem with mediocre tooling that has only gotten worse with time.

JavaScript has gotten better but it seems they are just re-learning things that were long figured out.

When I see new package managers, I just see a list of problems that they forgot to account for. Which I find strange when there have been many package managers that you can learn from. Why are you re-inventing the wheel?

replies(3): >>42182207 #>>42182685 #>>42183352 #
10. elashri ◴[] No.42181070{4}[source]
I understand that, you can use `--break-system-packages` or change configuration `python3 -m pip config set global.break-system-packages true`.

Python is different here because in many linux distributions, there are many tools that rely on you system python. Python unlike node is not limited (in practice) to web applications. that's why you have to be more careful. So while I understand you are using this as an example, I don't feel that your comparison is apple to an apple.

replies(1): >>42183091 #
11. lmm ◴[] No.42181244{3}[source]
> Libraries in the project fixes this whole issue for C/C++.

Yeah, make sure no-one can ever fix your security vulnerabilities.

> As for compiler issues, just run it with the same compiler.

And when the same compiler doesn't exist for your new machine?

Freezing everything makes things easier in the short term, but much harder in the long term.

12. regularfry ◴[] No.42181259{4}[source]
My slightly heretical opinion is that Debian would have been better off removing system pip entirely. The system python is for the system.
replies(1): >>42183221 #
13. skeletal88 ◴[] No.42181310[source]
Javascipt is a horrible language because it basically is missing a standard library so you need external dependancies even for the most basic things that are already present in other languages. Python has a very rich standard library. You can do a lot with libc, if you had a c++ Qt project then it would provide you with basically everything you could ever need.
replies(2): >>42182835 #>>42187241 #
14. wink ◴[] No.42182207{3}[source]
I am not sure you should put ant or maven as shining examples here, but I am kinda warming up to Gradle, at least without Groovy being involved.
replies(1): >>42183150 #
15. ahoka ◴[] No.42182685{3}[source]
"Java has a great ecosystem. It’s well thought out and I can compile and run 10 year old projects no problem."

We just had to workaround breaking changes in a patch version update of Spring Boot. Maybe it was true in 2005, but certainly not the case today. I know of products that are stuck in Java 1.8 and not because they are too lazy to upgrade.

replies(1): >>42183507 #
16. cies ◴[] No.42182835{3}[source]
> Javascipt is a horrible language because it basically is missing a standard library so you need external dependancies even for the most basic things that are already present in other languages

That's not the only reason. :)

Horrible syntax full of inconsistencies, bolted on type system with TypeScript helps but will always be bolted on, quirks everywhere, as if `null` was not bad enough they also have `undefined`, I can go on.

I simply avoid it for anything but small enhancements scripts on otherwise static HTML pages.

replies(1): >>42187285 #
17. LamaOfRuin ◴[] No.42183091{5}[source]
>Python unlike node is not limited (in practice) to web applications. that's why you have to be more careful.

They may or may not be running Node.js specifically, but I believe that many Linux distributions, as well as Windows, include JavaScript code in core applications. I don't see this as particularly different, except that they might choose to assume a single standard system Python that is able to be modified by standard Python development, whereas I would rarely expect that to be the case with however each component chooses to execute JavaScript.

replies(1): >>42183491 #
18. ivan_gammel ◴[] No.42183150{4}[source]
What do you get from Gradle that Maven cannot offer?
19. j1elo ◴[] No.42183221{5}[source]
My not so heretical opinion is that PIP should behave like NPM by default, and work under a local environment subdirectory, just like "npm install" already creates a "node_modules" directory where to put all files, without the user needing to specify how and where and which env tool to use.
replies(2): >>42184259 #>>42184267 #
20. demosthanos ◴[] No.42183352{3}[source]
In JetBrains's Developer Ecosystem 2023 survey, 50% of developers were still regularly working in Java 8 [0]—the exact kind of "stick with the old version of the runtime" solution described in TFA.

[0] https://www.jetbrains.com/lp/devecosystem-2023/java/

replies(1): >>42183515 #
21. elashri ◴[] No.42183491{6}[source]
Apps that rely on OS provided Webview and electron apps are totally different situation. This is exactly what I said. And no, they don't use any standard nodejs installation like python. And they are different as I said. so this is still apples to orange comparison.
replies(1): >>42183642 #
22. cess11 ◴[] No.42183507{4}[source]
I've been involved in bringing real old Java 1.4 and 6 and whatnot up to 17 and from classic app servers into cloud, can take a bit of work but it's pretty straightforward, mostly switching out deprecated methods to their successors and copying over boilerplate config from similar applications.
replies(1): >>42183901 #
23. lucianbr ◴[] No.42183515{4}[source]
Java 8 is 10 years old. If you had a project with a Java version that was recent 4 years ago (11 - 14), you could run it without any problems or changes.
replies(1): >>42183583 #
24. demosthanos ◴[] No.42183583{5}[source]
Because they made the design choice to stop making large breaking changes to the language and tooling. Java 8 to 9 wasn't easier than Java 8 to 17 is, it's getting off of Java 8 that is hard because they made the choice to break so much in 9.

Node does not promise indefinite backwards compatibility, which is a design choice that they've made that allows them to shed old baggage, the same way that the Java developers chose to shed baggage in 8->9. Neither choice is inherently better, but you do have to understand which choice a language's designers were making during the time window in question when you go to run it later.

25. LamaOfRuin ◴[] No.42183642{7}[source]
>Apps that rely on OS provided Webview and electron apps are totally different situation.

No, they're not. I'm talking about core apps and services that are essential to a functional operating system. This is exactly the same situation. The difference is choices made by the OS and language ecosystem about how to manage dependencies in various use-cases. It is an apples to oranges comparison because of those decisions and not because of the language.

replies(1): >>42189302 #
26. mleo ◴[] No.42183901{5}[source]
Depends on the frameworks in use. I have done the same as you in bringing code that was originally started on 1.4 up to 17 and now 21 and it just took grunt work, but not too crazy since most of it was bog standard Java.

However, some other projects around here using different application frameworks are stuck since the frameworks aren’t maintained or upgraded in ways that aren’t compatible anymore.

Looking into old Java code, it is hard to remember a time before enums and what a pain that is to deal with int constants instead of typed constants.

27. liontwist ◴[] No.42184179[source]
I check out C projects which have not been updated in 15 years and run make.
replies(1): >>42185744 #
28. secondcoming ◴[] No.42184227{4}[source]
Encountered this too. So annoying.
29. secondcoming ◴[] No.42184259{6}[source]
Python is a scripting language. I shouldn’t need to faff about with environments if I want to run my script on another machine.
30. regularfry ◴[] No.42184267{6}[source]
Ah, but that would require that the python interpreter look first in the local directory in case there's a virtualenv there, which would mean your system could break depending on which directory you ran bits of it from. Less than ideal.

It's better all round to just assume that unless you're building something to be a part of the system itself, that the system interpreters just aren't for you. There's a special case for shells where they're actually UI, but I've seen so much effort wasted over the years trying to let system interpreters do double-duty as both system tools and development environments that I've come to the conclusion that it's simply not worth the hassle.

replies(1): >>42189169 #
31. ◴[] No.42185263[source]
32. ◴[] No.42185292[source]
33. icedchai ◴[] No.42185744{3}[source]
I have C code that I wrote in 1995 that still builds. There are many warnings, however.
34. leptons ◴[] No.42187241{3}[source]
A standard library is not a "language" feature.
35. leptons ◴[] No.42187285{4}[source]
It's okay for you to have the opinions you do, but I have zero problems programming very complex systems with Javascript, even without Typescript (before Typescript ever existed). Javascript has always been the easiest language to build anything with for me. And yes, I know a dozen other languages including C, C++, C#, Python, Go, various flavors of Assembly, and more - but Javascript is still my favorite. YMMV.
replies(1): >>42191924 #
36. jakimfett ◴[] No.42187920{3}[source]
That sounds pretty frustrating.

When I find my shell scripts from 20+ years ago, they still just run as intended.

37. j1elo ◴[] No.42189169{7}[source]
That's the idea, yes. Do you have by any chance any experience with Node.js? Running a JS script is usually done in two steps:

  1. npm install
  2. node my_script.js
First one downloads and installs all dependencies listed in a package.json file into a node_modules local subdir. This is equivalent to creating a pip venv, activating the venv, and running pip install against a requirements.txt file.

Second one runs the interpreter with the script file and against the locally downloaded dependencies.

I.e. the local env dirs in Node.js are not a suggestion that you need to learn about, make choices, and actually use; they are just how the tool works by default, which makes the experience of using Node.js with NPM by far much better and less confusing than the default experience of using Python with PIP.

replies(1): >>42191992 #
38. jcelerier ◴[] No.42189302{8}[source]
Which apps would that be ? I'm pretty sure there's zero node server running on my desktops & laptops at the moment
39. d3VwsX ◴[] No.42191776[source]
I don't know if any API does this, but I often wished that APIs I used could mark up just a tiny, tiny subset as @FutureSafe, like the opposite of tagging deprecated code, so that for smaller projects you could stick to only or mostly those parts and know that you can come back after 2 years or 20 years and things still work. Maybe throw in a compiler flag to verify that nothing not-@FutureSafe is used by accident. Sometimes you just want to write something small, once, and not have to actively maintain it forever. Outside of shell-scripts or retro-platform code you can barely write Hello World for any target today and feel confident that it will still run six months from now.
40. cies ◴[] No.42191924{5}[source]
> It's okay for you to have the opinions you do

Likewise.

> I know [...] C, C++, C#, Python, Go, various flavors of Assembly

That's good. But these are all languages that either lack strong typing and or are themselves rather quirky.

Only C# and Go stand out, IMHO, as languages that are recently designed. Even Python did not have user defined classes in the first versions, and some things thus feel off (__len__, __init__, etc.).

Also C# and Go still have implicit nulls all over the place. Their designs show ignorance for modern language design. Sum-types, explicit null, immutability, sound type systems -- all lacking in all langs you mention.

So what languages do have these IMHO "Game changers"? OCaml/ReScript/ReasonML, Haskell, Elm, Rust, Gleam, F#, Scala, Kotlin, ...

Those languages really showed _me_ something important: how it could be better.

There is another group of languages that also sits on a unique place in the solution space: the LISPs (incl. Racket, Schemes and Clojure). I found it very worth while to learn to program with them as well.

replies(2): >>42195478 #>>42196133 #
41. regularfry ◴[] No.42191992{8}[source]
I have years of painful experience with node.js, yes. The critical difference between node and python is that there are no system-provided scripts on my system which have `#!/usr/bin/node` as a first line.

There are a load of scripts with `#!/usr/bin/python` (or similar) in `/bin`, which means package resolution can't look first in a local subdir otherwise all bets are off. Again: your system will break depending on which directory you run bits of it from. The system-provided process would be loading dependencies that it was not tested against. In case this is unclear, you do not want that to happen. It would be bad. On my system I can see python scripts involved in driver management. I do not want them to do unexpected things. It would be bad.

Python package management is a mess in lots of ways, but this particular choice isn't one of them.

replies(1): >>42192054 #
42. fragmede ◴[] No.42192054{9}[source]
> which means package resolution can't look first in a local subdir

Sure it can, it's just a matter of examining where it's being run from.

I wrote python-wool to load packages from a venv if it finds one.

https://github.com/fragmede/python-wool

replies(1): >>42193196 #
43. regularfry ◴[] No.42193196{10}[source]
Yep. That comes under the category of "not default". Although now you've pointed it out I'll probably be using it.
44. neonsunset ◴[] No.42195478{6}[source]
In the last few years C# did away with implicit nulls. Nullable and non-nullable object references are disambiguated with T? and T. There are multiple keywords and expressions to further make it nice to work with these. You would be correct to note that there are "nullability holes" in certain edge-case scenarios, particularly around JSON serialization. But other than that it's a pretty smooth sailing.

If you do use C#, you may also want to add <WarningsAsErrors>nullable</WarningsAsErrors> to .csproj too.

replies(1): >>42199604 #
45. leptons ◴[] No.42196133{6}[source]
I prefer Assembly before any of the fringe languages you mentioned. There are no types in Assembly, and I rather like it that way. If you know how to work with data, then there's very little confusion about what you're doing.

And there's a reason practically nobody uses the languages you mentioned, and Javascript is so wildly popular. Most people don't really like or need type nagging systems. Sure, if you're trying to launch a rocket or doing something like building medical equipment or something else that requires covering your ass, then yeah, sure, go ahead and type the hell out of it. But for most programming tasks the languages you mentioned are overkill and frankly too obscure to use.

replies(2): >>42197735 #>>42199653 #
46. throwaway14356 ◴[] No.42197735{7}[source]
only one type :p
47. cies ◴[] No.42199604{7}[source]
I know it's a bit like Kotlin. I heard though that C#'s move still has some std lib bits that are nullable.
replies(1): >>42199981 #
48. cies ◴[] No.42199653{7}[source]
JS is popular due to it being the only browser lang. Did you forget that?

Also: TS popularity shows that not everyone in the JS community agree with you.

For server side web dev you will find that statically typed langs (Java, Kotlin, C#, Go) are a big chunk of the pie. Sure it also comes down to taste, but if you work in a large team, having stronger types can greatly help to keep the codebase in shape. (better IDE refactor tools, clearer for noob, harder to hide/ check in rubbish to git)

If you are afraid by obscurity, have a look at Kotlin!

replies(1): >>42202391 #
49. neonsunset ◴[] No.42199981{8}[source]
The idea is not to never have nulls. It is pointless (ha) - the way to understand T? vs T in C# is like an optional.

The entirety of standard library is annotated since long time ago. All new and not so new projects are also null-aware. Pretty much either completely legacy libraries or libraries that explicitly removed Nullable: enable that is set by default for all new project templates do not have those.

As I mentioned previously - it isn't perfect, but the level of "good enough" of NRTs in .NET is such that the nullability is a solved problem.

50. leptons ◴[] No.42202391{8}[source]
Typescript is still nowhere near as popular as Javascript, and likely never will be. It's overkill for the vast number of uses of Javascript.
replies(1): >>42204216 #
51. cies ◴[] No.42204216{9}[source]
JS's uses have been growing steadily. The language was clearly not "designed" (I saw a talk about the first 10d of JS, little actual designing happened).

TS is to the rescue when you have a big JS project, because that's what JS is not good at: big projects and large teams.

replies(2): >>42210150 #>>42211295 #
52. phatskat ◴[] No.42210150{10}[source]
I’d love a link to this talk if you happen to have it handy!
53. leptons ◴[] No.42211295{10}[source]
Except big JS projects with large teams existed well before Typescript ever did, and it never stopped anyone from producing good results. Typescript really isn't making anything possible that wasn't possible before Typescript existed.