Stories
Slash Boxes
Comments

SoylentNews is people

posted by martyb on Friday April 09 2021, @07:07PM   Printer-friendly
from the Ironing-out-bugs dept.

Google Now Supports Rust For Android Os Development - 9To5Google:

For the past few years, Google has been encouraging developers to write Android apps with Kotlin. The underlying OS still uses C and C++, though Google today announced Android Open Source Project (AOSP) support for Rust.

This is part of Google’s work to address memory safety bugs in the operating system:

We invest a great deal of effort and resources into detecting, fixing, and mitigating this class of bugs, and these efforts are effective in preventing a large number of bugs from making it into Android releases. Yet in spite of these efforts, memory safety bugs continue to be a top contributor of stability issues, and consistently represent ~70% of Android’s high severity security vulnerabilities.

[...] Rust “provides memory safety guarantees by using a combination of compile-time checks to enforce object lifetime/ownership and runtime checks to ensure that memory accesses are valid.” Google has been working to add this support to AOSP for the past 18 months.

Performance is equivalent to the existing languages, while increasing the effectiveness of current sandboxing and reducing the overall need for it. [...] Other improvements include data concurrency, a more expressive type system, and safer integer handling.


Original Submission

This discussion has been archived. No new comments can be posted.
Display Options Threshold/Breakthrough Mark All as Read Mark All as Unread
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
(1)
  • (Score: 4, Funny) by Anonymous Coward on Friday April 09 2021, @07:38PM (4 children)

    by Anonymous Coward on Friday April 09 2021, @07:38PM (#1135460)

    That's last year's language. This year, all the cool programmers are using IBM COBOL for Android.

    • (Score: 3, Informative) by Anonymous Coward on Friday April 09 2021, @07:54PM (3 children)

      by Anonymous Coward on Friday April 09 2021, @07:54PM (#1135474)

      For when floating point calculations aren't good enough and you need true decimal math.

      • (Score: 0) by Anonymous Coward on Friday April 09 2021, @08:42PM (2 children)

        by Anonymous Coward on Friday April 09 2021, @08:42PM (#1135487)

        Java has had the ability for decades and Python has it too.
        It's essential when dealing with financial calculations.

        • (Score: 2) by maxwell demon on Saturday April 10 2021, @11:07AM

          by maxwell demon (1608) on Saturday April 10 2021, @11:07AM (#1135649) Journal

          It's essential when dealing with financial calculations.

          There's nothing essential in it. Sure, it's convenient if the language already supports it out of the box. But if it doesn't, it's not that hard to write it as a library. In particular given that the functionality needed for finance is rather limited; I'm pretty sure you'll not find any financial code calculating cosines or Bessel functions.

          --
          The Tao of math: The numbers you can count are not the real numbers.
        • (Score: 0) by Anonymous Coward on Saturday April 10 2021, @01:30PM

          by Anonymous Coward on Saturday April 10 2021, @01:30PM (#1135672)

          Java doesn't have operator overloading, so it does have a BigDecimal type but if you want to add BigDecimal a to BigDecimal b and multiply the result by BigDecimal c you have to do c.multiply(a.add(b)). That syntax gets irritating quickly. You're better off using a Domain Specific Language for the data format and do the operations through that rather than having dozens or hundreds of lines of d.multiply(e.add(f.dividedBy(g))). Scala and Kotlin have operator overloading, so if you're on the Java Virtual Machine you could use one of those for more intuitive syntax.

          I don't know how Python does it.

  • (Score: 3, Interesting) by melyan on Friday April 09 2021, @08:46PM (6 children)

    by melyan (14385) on Friday April 09 2021, @08:46PM (#1135488) Journal

    Kotlin is probably better, but Rust is pretty cool. Rust has been in AOSP for awhile--it's an enormous project with 1000+ repos and even needs a separate `repo` utility to manage all the git repos.

    • (Score: 1) by melyan on Friday April 09 2021, @08:54PM (3 children)

      by melyan (14385) on Friday April 09 2021, @08:54PM (#1135491) Journal

      After ego, we'll all speak one logical language. Something like lojban.

      • (Score: 0) by Anonymous Coward on Friday April 09 2021, @10:13PM

        by Anonymous Coward on Friday April 09 2021, @10:13PM (#1135524)

        Does your mother know you're using her computer again?

      • (Score: 0) by Anonymous Coward on Saturday April 10 2021, @04:50AM (1 child)

        by Anonymous Coward on Saturday April 10 2021, @04:50AM (#1135613)

        > Something like lojban.

        Why do you think that will succeed when this much older constructed language https://en.wikipedia.org/wiki/Esperanto [wikipedia.org] has barely gotten off the ground?

    • (Score: 0) by Anonymous Coward on Saturday April 10 2021, @01:40PM (1 child)

      by Anonymous Coward on Saturday April 10 2021, @01:40PM (#1135674)

      Kotlin is a better Java, an application and service language. Rust is - cue Rust flame war 1.13e92 - an attempt at a better C++, a systems language. Those are two separate niches. Tens of thousands of websites are written in Java or Kotlin. Few are written in C++ or Rust. Conversely tens of thousands of low level utilities, databases, compilers, scripting language runtimes, and other system programs are written in C++ and Rust. Few are written in Java or Kotlin.

      Some people would argue that Rust also an attempt at a better C. I think it depends upon how you look at it. A lot of programs with similar features and similar performance can be written in C or Rust, so in that sense the languages overlap a lot. But C has a much smaller set of features and a much shorter learning curve than Rust. And I don't mean that it will take a C programmer a longer time to learn Rust, I mean it will take any programmer a much longer time to learn Rust compared to C. The learning curve for C++ and Rust are much closer to each other than either is to the learning curve to C.

      • (Score: 1) by melyan on Sunday April 11 2021, @07:18PM

        by melyan (14385) on Sunday April 11 2021, @07:18PM (#1136101) Journal

        All true. Kotlin, in particular, seems to come from the same space that Swift did. Makes sense as they both target native apps.

  • (Score: 2) by Mojibake Tengu on Friday April 09 2021, @08:49PM (3 children)

    by Mojibake Tengu (8598) on Friday April 09 2021, @08:49PM (#1135489) Journal

    COBOL provided the same memory safety guarantees as Rust does now. BASIC too.

    No sane ancient system programmer would use them for kernel, though.
    Those post-modern developers... well, good luck!

    --
    Respect Authorities. Know your social status. Woke responsibly.
    • (Score: 2) by gawdonblue on Friday April 09 2021, @10:19PM (2 children)

      by gawdonblue (412) on Friday April 09 2021, @10:19PM (#1135525)

      You could turn-off the COBOL run-time type-checking and bounds-checking at compile-time for slightly-better run-time-performance, at least in MicroFocus-COBOL. I never found the marginal-improvements to be worth the added-risk. Perhaps useful for a CPU-intensive highly-optimised-library where you triple-checked your input-parameters.

      By-the-way: Did you know that COBOL uses hyphens to join-words in identifiers?

      • (Score: 2) by stormreaver on Saturday April 10 2021, @12:13AM

        by stormreaver (5101) on Saturday April 10 2021, @12:13AM (#1135546)

        By-the-way: Did you know that COBOL uses hyphens to join-words in identifiers?

        Yes, unfortunately, I did.

      • (Score: 3, Touché) by Mojibake Tengu on Saturday April 10 2021, @09:12AM

        by Mojibake Tengu (8598) on Saturday April 10 2021, @09:12AM (#1135642) Journal

        Check how C mistreats the '*', that's some real perversion.

        --
        Respect Authorities. Know your social status. Woke responsibly.
  • (Score: 2, Touché) by Anonymous Coward on Friday April 09 2021, @10:03PM (1 child)

    by Anonymous Coward on Friday April 09 2021, @10:03PM (#1135520)

    Neither C nor C++ have a CoC. Google is /all/ about the CoC!

    • (Score: 1, Funny) by Anonymous Coward on Saturday April 10 2021, @01:38AM

      by Anonymous Coward on Saturday April 10 2021, @01:38AM (#1135579)
      Google? Dirty CoC-suckers.
  • (Score: 1, Interesting) by Anonymous Coward on Saturday April 10 2021, @02:45AM (1 child)

    by Anonymous Coward on Saturday April 10 2021, @02:45AM (#1135591)

    When the tool is more complicated than the things you want to make, it's a failure.

    C++ "succeeded" because it creeped out C, a minimal, very successful language. Rust, I suppose, creeped out of C++, but C++ is not a language that can be fixed by creeping.

    • (Score: 1, Informative) by Anonymous Coward on Sunday April 11 2021, @06:03AM

      by Anonymous Coward on Sunday April 11 2021, @06:03AM (#1135954)

      When the tool is more complicated than the things you want to make, it's a failure.

      I have a human body. I want to make urine. I'm a failure. And a tool!

      Rust, I suppose, creeped out of C++

      It is designed to fix problems in C and C++, but it was originally written in OCaml and doesn't really have C or C++ heritage.

(1)