3
jestdotty
55d

I do not like rust's choice to just infer something from how it is named

like if you install a package that begins with "cargo-something" then it becomes a cargo command. this feels janky

also turns out if you have a build.rs file it will build stuff for you when compiling? I just ran into this being described in the docs. well guess what. I have a build.rs file. it isn't being used for that though. I mean hasn't caused any problems, or has it?! I DON'T KNOW

config options seem more explicit than this naming nonsense. I just had to rename my project everywhere so it can be a cargo command. ffs now my git links are broken and shit.

I thought rust was verbose because it knew the merits of being explicit. can they stick to their principles pls

Comments
  • 1
    thank god it's "cargo" and not "rust", name it "rust-something" and it's rust foundation on your ass 🙄
  • 1
    ps: I feel like most of what's been added ad-hoc to rust fails to meet the language's principles
  • 1
    What's the use case for naming anything "cargo-something" while knowing that the package manager is called cargo? I'd never name anything "npm-something" for js without it being an npm tool.
  • 0
    I think convention-over-configuration is fundamentally different from implicit behaviour. Implicit behaviour is decided based on potentially broad context. If rust treats any file called build.rs as a build script, that's implicit behaviour. If only src/build.rs is considered, it's CoC.
  • 1
    my completely contrived idea here is that it's CoC if it's not harder to check the convention than it would be to check the configuration.
  • 1
    I'm a big fan of CoC by the way. You learn what kind of files Cargo treats specially once and from then on you'll be able to quickly read every Rust project on github.
  • 0
    Auditing all of your NPM dependencies is a nightmare because they all use different build systems and structures so just entering a project takes minutes. In Rust you can instantly start reading the code, and only need to read the part that applies to your use case.
  • 1
    @jestdotty https://doc.rust-lang.org/cargo/ is a useful read, though I agree that it sorely needs a complete example of package structure with all special files included.

    I finally checked build scripts, they have to be in the package root, outside /src. Rust should complain if you put a regular file there because it's not actually addressable from the real source files inside /src.
Add Comment