News for hackers. Stuff that matters.
Re:Ask HN: Is there a reason every language comes with it's ... by gwbas1c on Sunday February 19, 2023 @05:14PM (#34862403)
I think this is a great question, but I'd suggest expanding a bit in your post. I think if you expanded your question a bit, this would make it to the front page.

But, to answer your question: In general, every language has its own memory model. This leads to different semantics in how data and APIs are represented. Calling an API (package) from a language that it wasn't written in always requires a certain amount of extra work. (.net was an attempt to solve this, but in practice only C# took off, and the memory model in .net has a lot of tradeoffs that make it a poor "one size fits all" situation.)

But, to build on this, every language generally has a different way of dealing with external dependencies.

So, with it generally being difficult to do something like pull a C# library into Python, or pull a Java library into C, there's really no reason to have a universal package manager.

You'd need to start with a standard way to share libraries across languages. Given how COM and .net fared in this area, I think you'd end up like this: https://xkcd.com/927/

Re:Ask HN: Is there a reason every language comes with it's ... by logicalmonster on Sunday February 19, 2023 @07:16PM (#34863382)
> But, to answer your question: In general, every language has its own memory model.

Maybe I'm very ignorant about something really important, but isn't this arguably irrelevant for a basic package manager functionality?

What do package managers actually do?

Isn't the core of it basically moving the asked-for collection of files into some standard accessible folder and then triggering the right events to install or process whatever needs to be installed in order to run a program if possible?

Whenever you install a JavaScript library for example, npm copies 50,000 folders and files into some node_modules folder and then just updates a package listing. npm doesn't guarantee that any program you use that library in will actually run or be functional, after all.

A universal package manager wouldn't have to force a Java library to run in a JavaScript project, but it could simply copy the files from that package manager and give you some configuration or other information needed to run Java if you so choose.

Re:Ask HN: Is there a reason every language comes with it's ... by gwbas1c on Sunday February 19, 2023 @11:32PM (#34864918)
If it was that simple you'd see languages coalesce around 1-3 winners, kinda like what's happened with every IDE under the sun integrating with git.

A lot of this has to do with the semantics of how a language imports its dependencies.

For example: Look deeply into a NuGet package. It often has multiple builds, because in the .net ecosystem, 3rd party libraries are always dynamically linked. These different builds can be different versions of .net, and may include native dlls for different instruction sets.

Npm and cargo tend to bring in source code. Cargo lets you suck in a git repo directly. This is totally different than .net; again because these systems are source code based.