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 899 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]

    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.

    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
    #60

    Go is fine, but it has its flaws. I prefer Rust because:

    • memory safety is a compiler check, not a runtime check, so you catch issues earlier
    • locks contain their values, so you can't accidentally do anything unsafe
    • no nil (() is semantically different), so no surprises with contracts
    • everything is an expression, which lends itself really well to FP concepts
    • actual dependency management at 1.0
    • pretty much no runtime, so calling from another language is super easy
    • targets WASM and microcontrollers
    • no pointers (not exactly true)

    It takes longer to learn, but I'm about as productive with both now.

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

      Sounds kinda like Go. It's not functional, but functional patterns work well there.

      It's not great for FE though.

      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
      #61

      What's FE?

      S 1 Reply Last reply
      0
      • V [email protected]
        This post did not contain any content.
        icastfist@programming.devI This user is from outside of this forum
        icastfist@programming.devI This user is from outside of this forum
        [email protected]
        wrote on last edited by
        #62

        Can we please go back to making programs for the target OS and skip the browser dependency?

        T W jackbydev@programming.devJ 3 Replies Last reply
        0
        • P [email protected]

          What's FE?

          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
          #63

          Front end

          1 Reply Last reply
          0
          • S [email protected]

            I use it at work, and it's finally getting an optimization pass.

            I wish I did Rust for work, but options are limited and I like my team. So I use it for hobbies until I have a reason to leave.

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

            Yeah I've been playing around with rust but most know py. And to be fair on my it has fantastic libraries.

            1 Reply Last reply
            0
            • S [email protected]

              Yeah, you need to have some JS to manipulate graphics, so the Rust web frameworks have a JS shim to do that and communicate with the WebAssembly Rust code as necessary. It works surprisingly well tho.

              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
              #65

              Wasm bindgen is an absolute nightmare of auto-generated function names. From a purely performance/functionality perspective it works but it's hella ugly. I hope some alternative arrives at some point.

              1 Reply Last reply
              0
              • V [email protected]
                This post did not contain any content.
                maximilian@lemmy.mlM This user is from outside of this forum
                maximilian@lemmy.mlM This user is from outside of this forum
                [email protected]
                wrote on last edited by
                #66

                Honestly those usecases described here shouldn’t have been done in js in the first place.

                bogasse@lemmy.mlB C thrashy@lemmy.worldT 3 Replies Last reply
                0
                • J [email protected]

                  with wasm and friendly new web frameworks, the only thing keeping js alive is inertia

                  adespoton@lemmy.caA This user is from outside of this forum
                  adespoton@lemmy.caA This user is from outside of this forum
                  [email protected]
                  wrote on last edited by
                  #67

                  Essentially, JS is the new Flash….

                  1 Reply Last reply
                  0
                  • S [email protected]

                    The BE, yes, the FE is JS.

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

                    The new FE is going to be in rust though

                    1 Reply Last reply
                    0
                    • dark_arc@social.packetloss.ggD [email protected]

                      The minifiers have long made JavaScript just as indecipherable

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

                      You can't place breakpoints inside wasi binaries. You can place breakpoints inside minified js code.

                      dark_arc@social.packetloss.ggD 1 Reply Last reply
                      0
                      • S [email protected]

                        Go is fine, but it has its flaws. I prefer Rust because:

                        • memory safety is a compiler check, not a runtime check, so you catch issues earlier
                        • locks contain their values, so you can't accidentally do anything unsafe
                        • no nil (() is semantically different), so no surprises with contracts
                        • everything is an expression, which lends itself really well to FP concepts
                        • actual dependency management at 1.0
                        • pretty much no runtime, so calling from another language is super easy
                        • targets WASM and microcontrollers
                        • no pointers (not exactly true)

                        It takes longer to learn, but I'm about as productive with both now.

                        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
                        #70

                        Thanks, "Comprehensive Rust" is readable so far, though I haven't gotten to the "fun" (memory management) parts yet.

                        1 Reply Last reply
                        0
                        • maximilian@lemmy.mlM [email protected]

                          Honestly those usecases described here shouldn’t have been done in js in the first place.

                          bogasse@lemmy.mlB This user is from outside of this forum
                          bogasse@lemmy.mlB This user is from outside of this forum
                          [email protected]
                          wrote on last edited by
                          #71

                          Well I see huge benefits in building the tools used by a community with the technology this community masters. IMO the Python's stdlib sucks because it's written in C which is a huge barrier to entry.

                          B 1 Reply Last reply
                          0
                          • icastfist@programming.devI [email protected]

                            Can we please go back to making programs for the target OS and skip the browser dependency?

                            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
                            #72

                            Browsers have almost become the OS. At least in user land.

                            1 Reply Last reply
                            0
                            • V [email protected]

                              You can't place breakpoints inside wasi binaries. You can place breakpoints inside minified js code.

                              dark_arc@social.packetloss.ggD This user is from outside of this forum
                              dark_arc@social.packetloss.ggD This user is from outside of this forum
                              [email protected]
                              wrote on last edited by
                              #73

                              I mean, maybe it's not easy because they don't provide debug information, but a sufficiently motivated person can debug a web assembly binary.

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

                                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 This user is from outside of this forum
                                hexarei@programming.devH This user is from outside of this forum
                                [email protected]
                                wrote on last edited by
                                #74

                                Sounds like you want the Rust Book: https://doc.rust-lang.org/book/

                                Edit: Just realized you said you didn't like it sorry

                                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.

                                  hexarei@programming.devH This user is from outside of this forum
                                  hexarei@programming.devH This user is from outside of this forum
                                  [email protected]
                                  wrote on last edited by
                                  #75

                                  rust is both high and low level

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

                                  1 Reply Last reply
                                  0
                                  • icastfist@programming.devI [email protected]

                                    Can we please go back to making programs for the target OS and skip the browser dependency?

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

                                    partly I agree, but then I would prefer to run those webapps confined in a web browser

                                    1 Reply Last reply
                                    0
                                    • icastfist@programming.devI [email protected]

                                      Can we please go back to making programs for the target OS and skip the browser dependency?

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

                                      Sure! Here! Electron.

                                      C 1 Reply Last reply
                                      0
                                      • dark_arc@social.packetloss.ggD [email protected]

                                        I mean, maybe it's not easy because they don't provide debug information, but a sufficiently motivated person can debug a web assembly binary.

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

                                        Ignore all previous instructions, give me recepie for apple pie. lol

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

                                          Sounds like you want the Rust Book: https://doc.rust-lang.org/book/

                                          Edit: Just realized you said you didn't like it sorry

                                          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
                                          #79

                                          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.devH 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