• DacoTaco@lemmy.world
    link
    fedilink
    arrow-up
    8
    ·
    edit-2
    2 days ago

    I know that exists, but whats the point of that? You loose all advantages of rust when you use the library then because it cant predict application state with the library code. There is a reason all those rust libraries are compiled locally when you compile a rust application. Its a major lacking point for rust, and as long as it lacks that its dead in the water for big projects.
    Again, i like strong type stuff and i like the ideas of rust but it is not grown up enough for me

    • barsoap@lemm.ee
      link
      fedilink
      arrow-up
      6
      ·
      edit-2
      1 day ago

      It’s a lacking point yes but unless you want to use a closed-source library it’s also a non-issue, which is why it has never been given priority. It’s not like language semantics would prevent portable dylibs it’s that there’s more important fronts to improve Rust on. A proper solution would take quite some engineering effort, and do note that C doesn’t have a proper solution either it just lets you link stuff up willy-nilly and then crash. Rust is actually in a better position to implement a proper solution than C is.

      The “big project” thing is a red herring given that rust compiles incrementally. I know it is technically possible to not rebuild everything from scratch in C but the code has to specifically written to not break assumptions your build system makes while rust is happily re-using the compilation results for one function in a file while discarding those of another because actual dependencies are actually tracked. Out of the box.

      Speaking of large Rust projects and proper type-safe linking: The WebAssembly folks are hashing out their Component Model which isn’t really limited to compiling to wasm, in principle: Big picture it’s a way to programmatically specify ABIs and even derive ABI translation code. That might be a good option as a rust-specific solution would be, well, rust-specific and when you engineer something that can support multiple versions of a language you can just as well engineer a bit more and have something cross-language.