• 11 Posts
  • 400 Comments
Joined 3 years ago
cake
Cake day: July 6th, 2023

help-circle



  • “Fearless Concurrency” predates “async” in rust nomenclature, and points to specific compile-time guarantees around things like thread safety and races (Send, Sync, …).

    It was around when we used event loops and the mio crate (and rayon for parallelism), with no async or await in sight (because they didn’t exist yet).

    Some people actually still prefer to do “concurrency” this way, especially if they wish to stay close to the abstraction level from C land. io_uring also came later which introduced a new OS low-level interface and paradigm for doing “concurrency”.

    “Fearless Concurrency” has nothing to do with how easy you can write async code, especially if you’re someone who struggles with the language basics like ownership.



  • Why are you hallucinating facts?

    • There is no “team of 200 rust developers”.
    • “<lang> developer” is not an identity.
    • uutils is not a “professional” project, as in people are paid by the (non-existing) uutils company to work on it.
    • The project started as personal hobby of one person during COVID, There were no 200 contributors who sprung up magically and simultaneously from the start.

    They wanted to avoid the “politics” and are not entertaining comments or explaining their decisions. It’s not up for discussion.

    If you think you saw a group of 200 people starting uutils and doing this. You should seek medical help.







  • I don’t understand the problem.

    cargo new tt-build
    cd tt-build
    cargo new --lib opt-dep
    echo 'pub const NAME: &str = "opt-dep";' > opt-dep/src/lib.rs
    
    // build.rs
    fn main() {
        #[cfg(feature = "opt_dep_b_ft")]
        println!("cargo:warning={}", opt_dep::NAME);
        #[cfg(not(feature = "opt_dep_b_ft"))]
        println!("cargo:warning=none");
    }
    
    // src/main.rs
    fn main() {
        #[cfg(feature = "opt_dep_r_ft")]
        println!("Hello with {}", opt_dep::NAME);
        #[cfg(not(feature = "opt_dep_r_ft"))]
        println!("Hello with none");
    }
    
    # Cargo.toml
    [package]
    name = "tt-build"
    version = "0.1.0"
    edition = "2024"
    
    [features]
    default = ["opt_dep_b_ft", "opt_dep_r_ft"]
    opt_dep_b_ft= ["dep:opt-dep"]
    opt_dep_r_ft= ["dep:opt-dep"]
    
    [dependencies]
    opt-dep = { path = "./opt-dep", optional = true }
    
    [build-dependencies]
    opt-dep = { path = "./opt-dep", optional = true }
    
    % cargo run --no-default-features 2>&1 | rg 'Hello|warn'
    warning: tt-build@0.1.0: none
    Hello with none
    
    % cargo run  2>&1 | rg 'Hello|warn'
    warning: tt-build@0.1.0: opt-dep
    Hello with opt-dep
    
    % cargo run --no-default-features --features=opt_dep_b_ft  2>&1 | rg 'Hello|warn'
    warning: tt-build@0.1.0: opt-dep
    Hello with none
    
    % cargo run --no-default-features --features=opt_dep_r_ft  2>&1 | rg 'Hello|warn'
    warning: tt-build@0.1.0: none
    Hello with opt-dep
    


  • Not cargo per se, but even the tutorial for a cli-tool is like “setup clap, which has 20 dependencies and a kitchen sink”. The whole (cargo-centric) ecosystem is much like Node, with the same problems.

    cargo new with-clap
    cd with-clap
    cargo add clap --no-default-features
    
    % cargo tree
    with-clap v0.1.0 (/tmp/with-clap)
    └── clap v4.6.0
        └── clap_builder v4.6.0
            ├── anstyle v1.0.14
            └── clap_lex v1.1.0
    

    And also, cargo.toml has inconsistencies and double-standards.

    Can you expand on that?



  • Not sure how are you and @kibiz0r@midwest.social coming up with these concerns.

    The only correct way to package such software is to vendor dependencies (packaged together or separately). And you can trivially change the sonames of vendored deps in your build scripts so that there are no conflicts whatsoever (I dual-package some stuff against an upstream and a fork and do just that). So dynamic vs. static is not the crux of the issue. The primary concerns are that distributors hate vendoring, irrespective of whether the vendored libs are linked in statically or dynamically. Distributors also hate potentially diverging forks maintained by random downstreams, which is what “patched dependencies” effectively are.

    There is always room for some leeway of course, but that would depend on how relevant your software is, and/or whether a maintainer would want to take that burden on.

    And finally, sometimes, such dependencies may provide added value that trumps all these concerns. So judging these things is always situational.


  • Then you could be forced to vendor everything. And if it’s open-source and relevant for distros to pickup, then you will need to find out if distros would be willing to take your library with its vendored libs (or package them separately just for your library)…etc.

    And you may need to figure out if there are bus factor concerns with your direct dependency, since such libraries are not necessarily maintenance free, even from a mere compiling/building stand point (what if a patched indirect dependency no longer builds with new compilers…etc).



  • I didn’t read your post. But note that ? depends on traits /type classes with associated types (Try, FromResidual, and From), and is often implemented for sum types (e.g. Result, Option) with at least two variants containing Output and Residual type values.

    The FromResidual part does value conversion for the Residual, which is how you e.g. get auto-converted error values matching the return Result value. These converted error values are often themselves contained in variants in an enum/sum Error type.

    So neither an actual equivalent in C++ is possible, due to type system limitations/differences, nor whatever you tried to do is an apples-to-apples match, or even represents two fruits from the same basket.




  • Off-topic: The switching between light background for text and dark background for code is stupid and annoying. Either use dark for both, or light for both (so I can apply my custom inverse shader without hurting my eyes or breaking the reading flow). This back and forth switching is almost as stupid as using a background color with middle lightness, which I’ve also seen.

    This has been irking me for a while, so I decided to randomly whine about it now.


    As for the blog content. It’s a weird collection of clippy bugs which covers basically the first half of the blog, then a couple of miri bugs and limitations. Then it finally gets to actual rust compiler stuff which just involves cfg_select (a nice to have) and c_variadic support (ffi use-case). So, IMHO, that title is a bit over the top, and it almost does a disservice to a lot of actual good and interesting work that is being done.