• asdfasdfasdf@lemmy.world
    link
    fedilink
    English
    arrow-up
    22
    arrow-down
    1
    ·
    edit-2
    5 days ago
    1. Rust is the best language for writing WASM in, so you can write Rust and run it in the browser without transpiling to JS.
    2. Rust isn’t just about speed or GC pauses. Its type system is amazing and allows you to encode things that you cannot in any other mainstream language.
    3. It’s so incredibly well designed, it fewla like that clip from Ricky and Morty where Morty feels what standing on a truly even plane feels like then has a panic attack when he leaves. Rust rethought everything from scratch, and isn’t just some new syntax or fancy compiler tricks. No null, no exceptions, no inheritance, new typing capabilities, etc.

    Go made some pretty poor design choices, and now even Google is choosing Rust for a lot of stuff instead.

    • solrize@lemmy.world
      link
      fedilink
      English
      arrow-up
      3
      ·
      edit-2
      5 days ago

      Thanks, and interesting point about Wasm if that is important. You can also compile C++ to wasm but then its C++ ;). I don’t know about Ada to Wasm.

      I don’t think Rust is quite mainstream yet either. My impression is that its type system has not caught up with Haskell’s except in a few areas, but of course nobody pretends Haskell is mainstream. I haven’t yet tried Idris.

      Golang seems to have a decent runtime model (lightweight threads, GC) though the language itself is underpowered. There is a Golang backend for Purescript that sounded interesting to me. The thing that turned me off the most about Purescript was the JS tooling. Purescript (purescript.org) is/was a Haskell-like language that transpiles to JS, intended for use in browsers, but Typescript filled this space before Purescript got much traction. That felt unfortunate to me.

      I don’t think HLL (high level language) has an official definition, but informally to me it has generally meant that the language is GC’d and that the native integer type is unbounded (bignum). By that standard, Rust and Ada are low level. I’ve so far thought of Rust as a modernized Ada with curly braces and more control of dynamic memory reclamation. Maybe there is more going on than that. Ada is still ahead of Rust in some ways, like generic packages, but Rust is working on that.

      If you have a suggestion of a no-nonsense Rust book, I’d be interested in looking at it. https://doc.rust-lang.org/book/ beat around the bush way too long before discussing the language, but I guess I should spend more time with it.

      • asdfasdfasdf@lemmy.world
        link
        fedilink
        English
        arrow-up
        10
        ·
        edit-2
        5 days ago

        I’d say Rust is definitely mainstream. Obviously not the level of JS or Python, but it’s being used all over the place. All FAANG companies, the Linux kernel, JS runtimes, web browsers, Android, Signal, Mullvad…

        IMO GC has nothing to do with high or low level. It’s just incidental that there’s a correlation. In GC you usually don’t need to think about manually allocating or deallocating memory or truly understand what pointers are (in some ways anyway). In C / C++ you do.

        In Rust you almost never manually allocate or deallocate, and you have both very high and low level APIs.

        I’d say Rust is both high and low level. It just depends what you use it for. If you want to build a CLI or a web server, it’s great for that. If you want to do kernel stuff and choose to flip bits around you can do that too.

        As for books, maybe you’d like trying Rustlings instead.

        • Hexarei@programming.dev
          link
          fedilink
          English
          arrow-up
          2
          ·
          4 days ago

          rust is both high and low level

          I like to describe this as “low level language with high level ergonomics”

        • solrize@lemmy.world
          link
          fedilink
          English
          arrow-up
          2
          ·
          5 days ago

          Thanks, Rustlings doesn’t sound like what I want either. I was hoping for a counterpart of Stroustrup’s C++ Reference Manual, or Riehle’s “Ada Distilled” or even K&R’s book on C. Something that systematically describes the language rather than distractions like the toolchain, mini projects, cutesey analogies, etc. I’m being too persnickity though, mostly because it hasn’t been important to me so far.

            • solrize@lemmy.world
              link
              fedilink
              English
              arrow-up
              1
              ·
              4 days ago

              I’ll probably have to read through it or maybe the Ferrocene standard, but for now, Comprehensive Rust is pretty good. I’ve been busy today but hope to finish it soon. Is it really true as someone mentioned that Rust binaries are always statically linked? That has its attractions but I would hope it’s controllable. Can you use the regular linker (ld) with it?

              • Hexarei@programming.dev
                link
                fedilink
                English
                arrow-up
                2
                ·
                4 days ago

                Rust libraries are statically linked by default yes, except for a couple of rather low level ones (glibc and a couple others I think) - Honestly though I’d be surprised if you come across a situation where it’s something necessary to think about in practice