Announcement

Collapse
No announcement yet.

Making The Case For Using Rust At Low Levels On Linux Systems

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • #21
    Originally posted by atomsymbol View Post

    OO through Generics?
    Yeah, as strange as that sounds. If you want to do anything that would otherwise involve inheritance, you would probably use generics and traits to pass around objects that implement desired functions. Although, if I remember right, you can take references to traits themselves and do dynamic dispatching. But Rust seems to prefer using Generics to pass around different objects.

    Like if you want a function that operates on something that implements/"inherits" a class/interface/trait that implements addition, you'd do something like:
    Code:
    fn do_thing<T: Add>(x : &T, y :&T) -> T {
      x + y
    }
    https://doc.rust-lang.org/std/ops/trait.Add.html

    Obviously, you could also just implement functions directly with structs without needing traits and call those functions in a way consistent with other OO languages. But that's not very interesting by itself. Traits is what really gives Rust the ability to do interesting things with objects.

    See also the HasArea example in the Rust book:
    https://doc.rust-lang.org/book/traits.html

    Comment


    • #22
      Originally posted by totoz View Post
      I wonder why suddenly Rust generates so much hype while Ada has been there for years.
      Haskell inspired languages, like Scala, have becoming popular because the functional approach, which primes for immutability, allowing easier parallelism as one doesn't share mutable data structures.

      Comment


      • #23
        Originally posted by totoz View Post
        I wonder why suddenly Rust generates so much hype while Ada has been there for years.
        C like syntax.

        Originally posted by caligula View Post
        Sure, the Ada compiler generates native binaries, but are they really comparable? Ada's feature set is close to Rust's main concepts?
        They're about the same features wise.

        On a side-note, the Rust people believe the previous failures of new systems languages was due to the syntax deviating too far from C-like high-school math. They're only partially right. While the syntax contributed immensely to previous failures, the real problem was all the burdensome features the computer science and math people shoved in there.
        You see, electrical engineers can't be bothered with generics and functional programming. Their job has so much overhead regarding physics and regulations that they just can't remember all those complex tools. And seeing as EEs write and debug drivers, kernels written with languages higher then procedures and pointers never got any traction.

        Comment


        • #24
          Don't compare rust with Ada. Ada does runtime checks, rust compile time checks. And rust does not have a GC like Ada.

          Comment


          • #25
            What about swift?

            Comment


            • #26
              Originally posted by tessio View Post
              What about swift?
              Not a system programming language, more like a app language

              Comment


              • #27
                Originally posted by stqn View Post
                So in the author’s mind Rust is the way to go, just like systemd.
                That’s not helping with my opinion of Rust.
                O.o

                ... *Insert a very well known picture of Jean-Luc Picard here*

                Comment


                • #28
                  Originally posted by cl333r View Post
                  But even for user-space. I'm doing Qt5 and the Rust binding I found [1] has only one example and this TODO list:
                  • More Qt modules support
                  • Global Qt functions support
                  • Qt enums support
                  • Qt generic container classes support
                  • Operator methods support


                  In other words it's not worth for me switching from a known language (C++11) with a good and known building system (cmake) with a good toolkit (qt5) to: an unknown but allegedly superior language (Rust) with an unknown building system (cargo or whatever) with inferior bindings to Qt5.

                  I'm trying to be unbiased here since I'm interested in good stuff, but Rust's pros and cons just don't do it for now for me.
                  If you're using frameworks like Qt, you are not writing low-level system software and are by de facto outside the scope of the blog post's subject matter.

                  Comment


                  • #29
                    Originally posted by FishB8 View Post
                    If you're using frameworks like Qt, you are not writing low-level system software and are by de facto outside the scope of the blog post's subject matter.
                    Agreed, with an addendum -- If you're using Qt, chances are even the currently chosen language (C++) might in fact be overkill.

                    Comment


                    • #30
                      Originally posted by andrei_me View Post
                      Haskell inspired languages, like Scala .... which primes for immutability, allowing easier parallelism as one doesn't share mutable data structures.
                      Immutable data structures are an efficient computational model of just a restricted subset of phenomena of the world.

                      Comment

                      Working...
                      X