Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

agnos.is Forums

  1. Home
  2. Technology
  3. Rust is Eating JavaScript

Rust is Eating JavaScript

Scheduled Pinned Locked Moved Technology
technology
101 Posts 54 Posters 894 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S [email protected]

    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.

    A This user is from outside of this forum
    A This user is from outside of this forum
    [email protected]
    wrote on last edited by
    #11

    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 major FAANG companies, the Linux kernel, JS runtimes, web browsers, Signal...

    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.

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

    S hexarei@programming.devH 2 Replies Last reply
    0
    • S [email protected]

      I had the impression Rust doesn't handle concurrency particularly well, at least no better than Python, which does it badly (i.e. with colored functions). Golang, Erlang/Elixir, and GHC (Haskell) are way better in that regard, though they each have their own issues. I had believed for a while that Purescript targeting the Erlang VM and with all the JS tooling extirpated might be the answer, but that was just a pipe dream and I don't know if it was really workable.

      S This user is from outside of this forum
      S This user is from outside of this forum
      [email protected]
      wrote on last edited by
      #12

      Rust makes multi threading very easy you can just use

      thread::spawn();
      

      But rust makes Async difficult because it's naturally stackless so you need to create your own scheduler or use someone else's like Tokio. Also, people have a bad habit of conflating async with concurrency which makes it more confusing.

      S 1 Reply Last reply
      0
      • S [email protected]

        The JS tooling universe has always seemed like a Lovecraftian hellscape to me. I've managed to stay away from it so far, but if I were caught in it, of course I'd be trying to escape any way I could. It sounds like Rust's attraction here has been as a viable escape corridor rather than anything about Rust per se.

        In particular, I get that everyone wants their code to be faster, and I get that certain bloaty apps (browsers) need to get their memory footprint under control, and a few niche areas (OS kernels, realtime control) can't stand GC pauses. Other than that though, what is the attraction of Rust for stuff like tooling? As opposed to a (maybe hypothetical) compiled, GC'd language with a good type system and not too much abstraction inversion (Haskell's weakness, more or less).

        Has Golang fizzled? It has struck me as too primitive, but basically on the right track.

        Rust seems neat from a language geek perspective, but from what I can tell, it requires considerable effort from the programmer handle a problem (manual storage reclamation) that most programs don't really have. I do want to try it sometime. So this post is intended as more inquisitive/head scratching rather than argumentative.

        glitchvid@lemmy.worldG This user is from outside of this forum
        glitchvid@lemmy.worldG This user is from outside of this forum
        [email protected]
        wrote on last edited by
        #13

        Maybe give it a try; it's my favorite language to write programs in now, it has an extremely good standard library, and for everything else there's a mass of high quality crates, its build system is actually competent and makes compiling on Windows or Linux trivial, plus many, many more quality of life features.

        S C 2 Replies Last reply
        0
        • V [email protected]
          This post did not contain any content.
          C This user is from outside of this forum
          C This user is from outside of this forum
          [email protected]
          wrote on last edited by
          #14

          Thank god.

          1 Reply Last reply
          0
          • S [email protected]

            Rust makes multi threading very easy you can just use

            thread::spawn();
            

            But rust makes Async difficult because it's naturally stackless so you need to create your own scheduler or use someone else's like Tokio. Also, people have a bad habit of conflating async with concurrency which makes it more confusing.

            S This user is from outside of this forum
            S This user is from outside of this forum
            [email protected]
            wrote on last edited by
            #15

            Sure you can spawn threads but now you have all the hazards of shared memory and locks, giving the 2.0 version of aliasing errors and use-after-free bugs. Also, those are POSIX threads, which are quite heavyweight compared to the in-process multitasking of Golang etc. So I would say that's not really an answer.

            A B 2 Replies Last reply
            0
            • S [email protected]

              I had the impression Rust doesn't handle concurrency particularly well, at least no better than Python, which does it badly (i.e. with colored functions). Golang, Erlang/Elixir, and GHC (Haskell) are way better in that regard, though they each have their own issues. I had believed for a while that Purescript targeting the Erlang VM and with all the JS tooling extirpated might be the answer, but that was just a pipe dream and I don't know if it was really workable.

              jimmux@programming.devJ This user is from outside of this forum
              jimmux@programming.devJ This user is from outside of this forum
              [email protected]
              wrote on last edited by
              #16

              Purescript targeting the Erlang VM

              Have you tried Gleam?

              S 1 Reply Last reply
              0
              • A [email protected]

                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 major FAANG companies, the Linux kernel, JS runtimes, web browsers, Signal...

                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.

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

                S This user is from outside of this forum
                S This user is from outside of this forum
                [email protected]
                wrote on last edited by
                #17

                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.

                hexarei@programming.devH 1 Reply Last reply
                0
                • jimmux@programming.devJ [email protected]

                  Purescript targeting the Erlang VM

                  Have you tried Gleam?

                  S This user is from outside of this forum
                  S This user is from outside of this forum
                  [email protected]
                  wrote on last edited by
                  #18

                  No I haven't, I'll take a look at it, though I felt suspicious of "task.async" as shown on the front page of gleam.run.

                  1 Reply Last reply
                  0
                  • glitchvid@lemmy.worldG [email protected]

                    Maybe give it a try; it's my favorite language to write programs in now, it has an extremely good standard library, and for everything else there's a mass of high quality crates, its build system is actually competent and makes compiling on Windows or Linux trivial, plus many, many more quality of life features.

                    S This user is from outside of this forum
                    S This user is from outside of this forum
                    [email protected]
                    wrote on last edited by
                    #19

                    Yes it's on my infinite todo list. I'm just being too much of a curmudgeon about the available textbooks, and had a sinking feeling when the main one didn't get "hello world" out of the way on page 1, and shift to the specifics of the language.

                    T glitchvid@lemmy.worldG 2 Replies Last reply
                    0
                    • V [email protected]
                      This post did not contain any content.
                      C This user is from outside of this forum
                      C This user is from outside of this forum
                      [email protected]
                      wrote on last edited by
                      #20

                      Nom nom nom

                      S 1 Reply Last reply
                      0
                      • S [email protected]

                        Yes it's on my infinite todo list. I'm just being too much of a curmudgeon about the available textbooks, and had a sinking feeling when the main one didn't get "hello world" out of the way on page 1, and shift to the specifics of the language.

                        T This user is from outside of this forum
                        T This user is from outside of this forum
                        [email protected]
                        wrote on last edited by
                        #21

                        I’ve used it the last few years to do Advent of Code (https://adventofcode.com/) and that’s been fun and challenging. Definitely recommend it. Better than trolling through a book of “now do this” examples if you’ve done other languages in the past.

                        S 2 Replies Last reply
                        0
                        • S [email protected]

                          I had the impression Rust doesn't handle concurrency particularly well, at least no better than Python, which does it badly (i.e. with colored functions). Golang, Erlang/Elixir, and GHC (Haskell) are way better in that regard, though they each have their own issues. I had believed for a while that Purescript targeting the Erlang VM and with all the JS tooling extirpated might be the answer, but that was just a pipe dream and I don't know if it was really workable.

                          A This user is from outside of this forum
                          A This user is from outside of this forum
                          [email protected]
                          wrote on last edited by
                          #22

                          I don't know but I don't think rust has that problem. In fact I've always thought its data ownership paradigm is literally the most optimal approach to concurrency and parallelism. I really love using rayon in rust for instance.

                          S 1 Reply Last reply
                          0
                          • S [email protected]

                            Sure you can spawn threads but now you have all the hazards of shared memory and locks, giving the 2.0 version of aliasing errors and use-after-free bugs. Also, those are POSIX threads, which are quite heavyweight compared to the in-process multitasking of Golang etc. So I would say that's not really an answer.

                            A This user is from outside of this forum
                            A This user is from outside of this forum
                            [email protected]
                            wrote on last edited by
                            #23

                            Go routines are certainly special and hard to match, but rust has all the normal abstractions of a language like C, just with a borrow checker so you can avoid memory leaks, write after read, etc.

                            1 Reply Last reply
                            0
                            • glitchvid@lemmy.worldG [email protected]

                              Maybe give it a try; it's my favorite language to write programs in now, it has an extremely good standard library, and for everything else there's a mass of high quality crates, its build system is actually competent and makes compiling on Windows or Linux trivial, plus many, many more quality of life features.

                              C This user is from outside of this forum
                              C This user is from outside of this forum
                              [email protected]
                              wrote on last edited by
                              #24

                              If Rust had been around when I was an underclassman, I would have been totally locked into the full CompSci track. Instead, I got introduced to Java and C (and calculus…) and that looked like a nightmare compared to what I had been playing with in JS/Python land, so I noped on out of there and got a Comp Sci Lite degree.

                              Years later, I’m just completely in love with Rust.

                              B 1 Reply Last reply
                              0
                              • S [email protected]

                                The JS tooling universe has always seemed like a Lovecraftian hellscape to me. I've managed to stay away from it so far, but if I were caught in it, of course I'd be trying to escape any way I could. It sounds like Rust's attraction here has been as a viable escape corridor rather than anything about Rust per se.

                                In particular, I get that everyone wants their code to be faster, and I get that certain bloaty apps (browsers) need to get their memory footprint under control, and a few niche areas (OS kernels, realtime control) can't stand GC pauses. Other than that though, what is the attraction of Rust for stuff like tooling? As opposed to a (maybe hypothetical) compiled, GC'd language with a good type system and not too much abstraction inversion (Haskell's weakness, more or less).

                                Has Golang fizzled? It has struck me as too primitive, but basically on the right track.

                                Rust seems neat from a language geek perspective, but from what I can tell, it requires considerable effort from the programmer handle a problem (manual storage reclamation) that most programs don't really have. I do want to try it sometime. So this post is intended as more inquisitive/head scratching rather than argumentative.

                                P This user is from outside of this forum
                                P This user is from outside of this forum
                                [email protected]
                                wrote on last edited by
                                #25

                                I think there's room for a rust-lite language that is GCed. Something with a functional-style type system and that compiles to machine code.

                                Roc is a candidate for this language. Basically Elm that compiles to machine code, but with a number of tweaks to make it work for more than just a web front end. Like Elm, the type system is haskell like, but simplified.

                                S B S 3 Replies Last reply
                                0
                                • T [email protected]

                                  I’ve used it the last few years to do Advent of Code (https://adventofcode.com/) and that’s been fun and challenging. Definitely recommend it. Better than trolling through a book of “now do this” examples if you’ve done other languages in the past.

                                  S This user is from outside of this forum
                                  S This user is from outside of this forum
                                  [email protected]
                                  wrote on last edited by
                                  #26

                                  Thanks, I was looking for a more straightforward academic-style textbook for non-beginning programmers, but I'll make do with what is out there.

                                  maxwellfire@lemmy.worldM 1 Reply Last reply
                                  0
                                  • A [email protected]

                                    I don't know but I don't think rust has that problem. In fact I've always thought its data ownership paradigm is literally the most optimal approach to concurrency and parallelism. I really love using rayon in rust for instance.

                                    S This user is from outside of this forum
                                    S This user is from outside of this forum
                                    [email protected]
                                    wrote on last edited by
                                    #27

                                    True, but of course it's always a trade-off. At a certain point I have to defer to your judgment, at least until I've written some Rust code. But I've written a fair amount of C++ and a little bit of Ada and don't find them all that convenient compared to Python or Haskell or whatever. We'll see. 😉

                                    A 1 Reply Last reply
                                    0
                                    • P [email protected]

                                      I think there's room for a rust-lite language that is GCed. Something with a functional-style type system and that compiles to machine code.

                                      Roc is a candidate for this language. Basically Elm that compiles to machine code, but with a number of tweaks to make it work for more than just a web front end. Like Elm, the type system is haskell like, but simplified.

                                      S This user is from outside of this forum
                                      S This user is from outside of this forum
                                      [email protected]
                                      wrote on last edited by
                                      #28

                                      Thanks, Roc sounds interesting. Ocaml also maps more closely to machine operations than Haskell does, so it has always seemed like another alternative. AMD has something called ROCm which is their version of CUDA, but I assume that is unrelated.

                                      1 Reply Last reply
                                      0
                                      • S [email protected]

                                        True, but of course it's always a trade-off. At a certain point I have to defer to your judgment, at least until I've written some Rust code. But I've written a fair amount of C++ and a little bit of Ada and don't find them all that convenient compared to Python or Haskell or whatever. We'll see. 😉

                                        A This user is from outside of this forum
                                        A This user is from outside of this forum
                                        [email protected]
                                        wrote on last edited by
                                        #29

                                        IME a language is as good as its package manager and libraries, and cargo is great.

                                        1 Reply Last reply
                                        0
                                        • S [email protected]

                                          The JS tooling universe has always seemed like a Lovecraftian hellscape to me. I've managed to stay away from it so far, but if I were caught in it, of course I'd be trying to escape any way I could. It sounds like Rust's attraction here has been as a viable escape corridor rather than anything about Rust per se.

                                          In particular, I get that everyone wants their code to be faster, and I get that certain bloaty apps (browsers) need to get their memory footprint under control, and a few niche areas (OS kernels, realtime control) can't stand GC pauses. Other than that though, what is the attraction of Rust for stuff like tooling? As opposed to a (maybe hypothetical) compiled, GC'd language with a good type system and not too much abstraction inversion (Haskell's weakness, more or less).

                                          Has Golang fizzled? It has struck me as too primitive, but basically on the right track.

                                          Rust seems neat from a language geek perspective, but from what I can tell, it requires considerable effort from the programmer handle a problem (manual storage reclamation) that most programs don't really have. I do want to try it sometime. So this post is intended as more inquisitive/head scratching rather than argumentative.

                                          R This user is from outside of this forum
                                          R This user is from outside of this forum
                                          [email protected]
                                          wrote on last edited by
                                          #30

                                          The JS tooling universe has always seemed like a Lovecraftian hellscape to me.

                                          That's most of any programming of today for me.

                                          If it can't be grasped in a couple of days - then na-ah.

                                          I can patch something I need working which doesn't, written in C.

                                          autotools ftw

                                          1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups