[HN Gopher] Rust Module System Encourages Bad Practices
___________________________________________________________________
Rust Module System Encourages Bad Practices
Author : flurker
Score : 23 points
Date : 2023-06-07 21:32 UTC (1 hours ago)
(HTM) web link (dmitryfrank.com)
(TXT) w3m dump (dmitryfrank.com)
| davidhyde wrote:
| The author desires a simple folder based module system and argues
| how it would improve compilation times. I do agree although it
| would be nice to know what flexibility would be lost so the
| argument could have some weight on the other side.
|
| On a tangent I recall struggling with cargo features in the
| beginning. I found them to be hidden and mysterious. Even
| searching for "rust features" sucks.
| physPop wrote:
| I feel like the author really overstates how hard it is to make a
| new crate. Making a cargo.toml is simple and frankly you don't do
| it so often as to be a burden.
|
| Encouraging cyclic dependencies on the other hand "because it is
| easy" seems like a lazy cop out.
| jchw wrote:
| Well, they seem to be cognizant of that, but they have a point:
| compared to simply creating a folder, it is QUITE a lot more
| effort. It's like the difference between zero and one.
|
| That having been said, I think my bigger issue with this is
| that this actually gets to be annoying after you do it, not
| just while doing it. Go manages _external_ dependencies on the
| module level, which is a level higher than packages. For Rust,
| it 's crates. So a repo with many crates becomes pretty
| cumbersome. (And a bit moreso if you're trying to maintain a
| Nix package for said repo, but that's _partly_ the fault of
| Nix. Only partly, because I actually think Rust 's toolchain
| makes the job of Nix rather difficult...)
| flurker wrote:
| Making Cargo.toml is annoying enough especially if we're
| factoring things out from an existing crate to a separate one:
| obviously we'll need to specify all the deps that the code is
| already using, and also possibly remove some deps from the old
| crate's Cargo.toml, and it can take a good chunk of time just
| to put it together. I mean it's nothing that we can't deal
| with, but it does slow things down for no good reason.
___________________________________________________________________
(page generated 2023-06-07 23:00 UTC)