Announcement

Collapse
No announcement yet.

Google Begins Allowing Rust Code For Developing Android

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

  • #31
    Originally posted by kpedersen View Post

    Rust basically requires a C++ compiler to prepare the *-sys packages and bindings. So you can never have C++ *or* Rust. If Rust is involved, it will always be C++ *and* Rust.

    Sounds a bit of a weak reason I know but until a 99%+ Rust native OS like Redox becomes mainstream you can't get away from ANSI C. And it just so happens that C++ consumes C headers better than Rust's FFI bindings ever can.

    C isn't just a language. It is the entire computing platform. C++ is (mostly) and extension of that. So making C++ as good as it can be is currently the best way to directly access the computing platform.

    (Unless Rust's unsafe {} system can be made to consume C headers directly by invoking a tiny inbuilt C compiler)
    Ah, ye olde No True Scotsman. Nobody is claiming that by writing code in Rust you're somehow magically fixing the mountain of existing code (mostly C and C++) your code stands on (like the OS and, heck, the Rust compiler itself sits on top of LLVM which is C++). But at least you can make your own code safer and better by using appropriate tools like, in some situations, Rust.

    And yes, there's a difference between C the language and C the lowest common denominator ubiquitous platform ABI (I think VMS is one of the rare exceptions with a language-independent platform ABI, but of course that's mostly irrelevant nowadays).

    Rust doesn't itself consume C headers, but there are projects like bindgen that can automagically produce Rust bindings for C (and some limited C++ subset) libraries (bindgen uses libclang, so it has a "real" C/C++ parser). Is it as convenient as using C or C++ directly? Obviously not, and there are certainly many cases where C or C++ is the better choice, but OTOH you gain a much better language to make up for the trouble and in many other cases that might well be worth it.

    Comment


    • #32
      Originally posted by microcode View Post
      I'll add that Ada was also more different from C than it really needed to be, through a mix of accident and intent, and its capture by tools vendors who only had a foothold in their niche was the death knell. Microsoft was able to make Visual Basic a resounding success despite being a single source because they already had a massive captive audience; random Ada toolchain vendors were in no such position, but they acted like they were.
      Back when Ada was designed in the late 1970'ies / early 1980'ies, C wasn't nearly as dominant as it was later to become. And AFAIU Pascal was a fairly common choice to teach students how to program, so at the time a Pascal-inspired syntax was a reasonable choice.

      But yeah, the Ada vendors almost exclusively focusing on the military-industrial complex with their bloated cost-plus contracts meant that Ada completely missed the personal computer revolution. Which later proved to be a fatal mistake, dooming Ada to near irrelevance.

      Comment


      • #33
        Originally posted by uid313 View Post
        I hope they write all parsers and decoders in this code. Such as Exif, ID3, etc. Saudi Arabia hacked Jeff Bezos by sending a specially crafted video file on WhatsApp.
        According to the lugenpresse, like (((BBC))), (((The Guardian))), (((CNN))), ((((((BuzzFeed)))))), etc.

        Comment


        • #34
          Rust is an absolutely terrible language and an even worse toolchain.

          Comment


          • #35
            Originally posted by 60Hz View Post
            Rust is an absolutely terrible language and an even worse toolchain.
            Why do you think that Rust is a terrible language?

            Comment


            • #36
              Originally posted by kpedersen View Post

              C++ done right is pretty close. They should start with that.
              C++, or any OOP language can't 100% replace C without doing tricky things.
              In C, the interfaces (functions) and the data members (structs) are naturally separated, but in OOP they were bonded together for some reason.

              Rust introduced the traits system to fully reproduce this aspect of C.

              Comment


              • #37
                Originally posted by paulpach View Post
                Love it or hate it, I don't know any other language that can really serve as a memory-safe replacement for C.
                Wonder about Swift when they add an ownership model in the near future?

                Comment


                • #38
                  Originally posted by dc_coder_84 View Post
                  Wonder about Swift when they add an ownership model in the near future?
                  What does that bring to the table on top of Rust?
                  Last I checked, Swift syntax was pretty much a clone of Kotlin. Which isn't the most legible syntax (at least to my eyes).

                  Edit: Just to be clear, Rust doesn't win any points for being easy on the eyes either. And neither did C or C++ before that. In fact, Rust is a strange beast. It can be as easy to read as Python, but it can look like a nightmare if you start inserting lifetime annotation gymnastics in there.
                  Last edited by bug77; 08 April 2021, 10:36 AM.

                  Comment


                  • #39
                    Michael, my post has been unapproved since yesterday.

                    Comment


                    • #40
                      Originally posted by bug77 View Post
                      What does that bring to the table on top of Rust?
                      Chris Lattner said the following when comparing Swift to Rust. He said the benefit of Swift is you don't have to always wrap your head around the borrow checker. I think the idea is to use Swift for application programming with no ownership annotations and with them in systems programming. That way you would have one language for application programming and low level software. I have not followed the recent Swift development but I guess Swift is not there yet. But sooner or later...

                      Comment

                      Working...
                      X