Hacker News new | ask | show | jobs
by rychco 729 days ago
My current feelings are that I really like Cargo, but don’t enjoy writing Rust. To be honest, if C++ had its own cargo I don’t think I’d ever reach for anything else.
4 comments

To be honest, because Cargo is good it makes me not want to leave it behind for something like Bazel.

If Cargo existed, people would not have developed interesting build systems like Meson and Ninja- and especially not Bazel which really leans in to fixing C++'s build issues.

In some cases, worse is better.

I don't think you can do dependent builds with cargo.

Like build a sub-target using say wasm-pack to then embed the output into a binary. IIRC it gets upset because the cargo lock is already acquired or something.

I have always wondered if it would be possible to write a language agnostic package manager. Lord knows we probably don't need more programming languages, but it would be much easier to get on of the ground if it could just plug itself into an existing package manager.
Same here, and I periodically research but remain disappointed; people usually just write a tool to address their current pet peeve and 1-2 years later the tool is of course abandoned.

Using just[0] as a task runner has solved a lot of per-project-scripts problems for me but it still cannot do DAG analysis + parallel task running of tasks not blocked on each other (or allow you to opt into serial or parallel task running). So it remains firmly in just the "task runner" territory.

I know many people would jump at the opportunity to say "just learn `make`!" but no thanks, I value my sanity. `make` is also inheriting a lot of bash-ism weirdness which makes it even worse.

The mage[1] tool that uses `Magefile`-s might be it but it's a bit more verbose (as it's Golang) and I am not sure how well does it integrate with the shell. Maybe script[2] can be used to complement it.

Sadly I don't have the time (and lately the inclination) to experiment but there are tools out there and I wish we finally started unifying things.

[0] https://github.com/casey/just

[1] https://magefile.org/magefiles/

[2] https://github.com/bitfield/script

What's so good about Cargo?
Cargo makes the easy cases very easy. And because it has existed for a very long time, this means that “the easy case” is a very very large amount of the overall cases.

This means that for the majority of folks and projects, it ends up being a very smooth experience.

That does not mean that Cargo is perfect, and there’s a lot of stuff it doesn’t do well.

In my limited experience, it makes the hard cases harder. I had a project where I needed to do some weird linker things and ended up moving to C++ because Cargo couldn't handle it.
At $dayjob we have ended up building three different build systems on top of Cargo. You're not wrong. But luckily those things are pretty rare, in my experience.

I am hoping that buck2 can get easier to use "in the small" and then just switch to it for all things, but it's too immature outside of Meta just yet.

How long have you been writing Rust?