←back to thread

A critique of package managers

(www.gingerbill.org)
109 points gingerBill | 8 comments | | HN request time: 0.001s | source | bottom
Show context
izzylan ◴[] No.45174868[source]
I don't see the value in making it even harder to build software. I want to make things. Downloading a dependency manually and then cursing at the compiler because "it's right there! why won't it load!!" is just gonna make me want to build software less.

Anyone I want to work with on a project is going to have to have the same frustration and want to work on the project less. Only even more because you see they downloaded version 2.7.3-2 but the version I use is 2.7.3-1.

replies(2): >>45175555 #>>45176326 #
dismalaf ◴[] No.45175555[source]
> Downloading a dependency manually and then cursing at the compiler because "it's right there! why won't it load!!"

Odin's compiler knows what a package is and will compile it into your program automatically.

replies(1): >>45177789 #
lifthrasiir ◴[] No.45177789[source]
Isn't that a (built-in) package manager if it works for general packages? Or does it work only for selected dependencies?
replies(2): >>45178616 #>>45178701 #
dismalaf ◴[] No.45178701[source]
It doesn't necessarily "manage" the packages. It just sees them in your project and compiles them. You manage them yourself.
replies(1): >>45178757 #
1. lifthrasiir ◴[] No.45178757[source]
If that's what happens, I think in the following claim:

> Odin's compiler knows what a package is and will compile it into your program automatically.

...the word "automatically" should be dropped. Of course compilers compile any supplied dependency "automatically", but it is so obvious that we don't often use the adverb just for that.

replies(1): >>45180825 #
2. dismalaf ◴[] No.45180825[source]
> Of course compilers compile any supplied dependency "automatically", but it is so obvious that we don't often use the adverb just for that.

They often don't though. Rust, C, C++ need either long command line invocations or a build system for anything beyond hello world. Zig needs a build file for anything beyond hello world.

With Odin, you just invoke "odin build ." and all your dependencies are taken in without needing a build system, build file, make file, etc...

replies(2): >>45181307 #>>45185760 #
3. lifthrasiir ◴[] No.45181307[source]
We call that a build system. It is not like that there is no build system; you have an integrated build system that is optimized for typical situations. Which is great by its own, but other languages and toolings would have optimized other metrics (for example, you can't ignore Cargo when talking about Rust's build system) so it is not a fair comparison.
replies(2): >>45181800 #>>45181818 #
4. gingerBill ◴[] No.45181800{3}[source]
It is a build system in the technical sense but it's hard to explain to people because they expect it to be separate from the language entirely. If I said Odin had a build system, they'd be expecting an external build script. And when you say you don't need that, they usually get really confused.

So how do you explain such a system to someone? This is a genuine question I am not sure how to answer.

5. dismalaf ◴[] No.45181818{3}[source]
I mean, is a "build system" even real? Or does it just exist because of a shortcoming with a compiler? All "compilers" have multiple steps usually invoking other programs at some point: parsing, actual code transformation, linking, etc..., some also find packages, some rely on an external tool or long command line invocations.

But yes, Odin builds it into their compiler. Rust doesn't but does have Cargo. Both are easy, as far as typical usage goes. Rust automates dependency management, Odin doesn't automate it per se but does make it easy. Which is what the whole discussion is about. A bunch of HNers whining that Odin makes it too hard, even though everyone sane uses Git anyway, and you can add dependencies using Git, and Odin will compile them without a build tool.

So for a Rust project you use Cargo + Git, for an Odin project you use Odin + Git, for a C/C++ project you use Meson (or something else if you hate life) + Git. In the end it's mostly the same, Bill just doesn't seem to want to deal with an NPM or Crates.io situation (and fair enough!).

replies(1): >>45192564 #
6. tialaramex ◴[] No.45185760[source]
This seems like a loss of separation of concerns. As a result Odin's compiler is full of completely unrelated stuff because it takes on this far larger role supervising everything about a project not just being a compiler.

Both Zig and Rust supply all of what you needed in the box, so all that Odin is doing here is commingling these features inside a single executable - there's no end user benefit that I can see.

replies(1): >>45186785 #
7. dismalaf ◴[] No.45186785{3}[source]
?? Zig's compiler does way more, from automatically generating bindings to C files to including the entire C toolchain in its executable to running Zig build files (which allow you to do stuff like fetch files from the Internet) and being a compiler.

Odin's compiler does more than rustc or clang, about the same as javac and less than Zig or Go's executables.

8. lifthrasiir ◴[] No.45192564{4}[source]
> All "compilers" have multiple steps usually invoking other programs at some point: parsing, actual code transformation, linking, etc..., some also find packages, some rely on an external tool or long command line invocations.

There is no technical reason the compiler can do the job of build system, but they are typically separated because of separation of concerns. Rustc needs not be tightly coupled with Cargo---it just has to understand enough of package concepts (`--extern`) for the actual compilation, so they can be independently managed and evolve. Odin's would be the polar oppsite, while Zig's approach is somewhere in the middle (compiler-as-a-library).