Slashdot Mirror


How Rust Can Replace C In Python Libraries (infoworld.com)

An anonymous reader quotes InfoWorld: Proponents of Rust, the language engineered by Mozilla to give developers both speed and memory safety, are stumping for the language as a long-term replacement for C and C++. But replacing software written in these languages can be a difficult, long-term project. One place where Rust could supplant C in the short term is in the traditionally C libraries used in other languages... [A] new spate of projects are making it easier to develop Rust libraries with convenient bindings to Python -- and to deploy Python packages that have Rust binaries.
The article specifically highlights these four new projects:
  • Rust-CPython - a set of bindings in Rust for the CPython runtime
  • PyO3 - a basic way to write Rust software with bindings to Python in both directions.
  • Snaek - lets developers create Rust libraries that are loaded dynamically into Python as needed, but don't rely on being linked statically against Python's runtime.
  • Cookiecutter PyPackage Rust Cross-Platform Publish - simplifies the process of bundling Rust binaries with a Python library.

9 of 304 comments (clear)

  1. But why? by Anonymous Coward · · Score: 4, Insightful

    Why use the new language of the month when C has been around for decades, is welll understood and does exactly what we want?

    How long before I start replacing rust with decay? 6 months? A year?

    1. Re:But why? by dlleigh · · Score: 3, Insightful

      Portability. Think of C as a portable assembler.

    2. Re:But why? by geoskd · · Score: 4, Insightful

      These days there's pretty much no reason to do any of this, which means that the only times you're going to do it is by accident. ie when you put a bug in your application.

      That has to be the most ignorant thing in these comments so far, and there are some pretty stupid things in the comments above...

      Ignoring the performance of your software is just plain dumb. Web companies tend to get away with it, because they are not paying for the compute power directly, but it still annoys their users. If Google or Bing ignored the performance of the software needed to perform search, they would need vastly more hardware to keep up with demand. It is no accident that the backend of Google Search is written in C++, and that this all runs on a customized linux based OS.

      Do you have an HDMI TV? Have you noticed that it takes many 10's of seconds to turn on? That is because some dumb F^@# thought it would be a good idea to implement the interface in Java and it takes *forever* to start up. 50+ years ago, Kernigan and Ritchie came up with C because assembler was not portable. decades later, Stroustrup came up with C++, and there has not been a language since that can match the performance of either.

      When you are selling 50M of a product, and you want to put a processor that costs $0.50 more in it because you are too incompetent to write efficient code, your ass will be fired and replaced with someone who can do their job. In the mean time I hope I never have to use a product that has any of your "work" product in it.

      --
      I wish I had a good sig, but all the good ones are copyrighted
    3. Re:But why? by Anonymous Coward · · Score: 3, Insightful

      C was never awful, It is and has always been a wonderful language. It is true that it is designed for people who know how a computer works... That might be a bit much to ask from "modern" "coders". If you have zero knowledge of what a computer actually does I can understand that you see it as awful.

  2. The future of rustlang is tied up with Mozilla by mnooning · · Score: 5, Insightful

    I've read a third of the Rust nightly book and watched many, many Rust videos on youtube. I like Rust very much. However, I believe Rust was invented by, is sponsored by, and gets it's major funding from the Mozilla foundation. There is essentially no more Mozilla Thunderbird, and the Mozilla Firefox browser is getting significantly less usage. We've had articles on such here on Slashdot. If the Mozilla browser itself falters any more, would Mozilla, and hence rust, stay alive?

  3. What happens to Rust when Mozilla is gone? by Anonymous Coward · · Score: 3, Insightful

    Rust is very tied to Mozilla. And Mozilla's only remaining "successful" product is Firefox. But Firefox's market share is dropping. It was only a few percent, last I saw, while Chrome is over 50%. Mozilla reportedly gets a lot of funding from Yahoo, due to a Firefox search deal. So here we have an organization with one major product, but this project is being rejected by consumers, and what might be this organization's most significant source of revenue comes from this failing product and is paid for by another company that isn't doing so well. I fear for Mozilla's future if, say, the Yahoo deal wasn't renewed and they couldn't find a replacement.

    If Mozilla goes the way of the dodo bird, then I can't see the Rust project really going anywhere. I don't think it has a robust independent community like C++ has, for example.

    I think it is too risky to adopt Rust, especially for important long term projects. The tech industry moves fast. Rust could plausibly be gone in 3 years, while languages like C, C++ and even PHP are far more likely to be going strong.

  4. Rust and SJW Nonsense by Anonymous Coward · · Score: 4, Insightful

    I was interested in learning Rust and perhaps using it for some personal projects, but then I discovered how the community seems to care so much about social engineering.

    We're not allowed to use "Master" and "Slave". https://github.com/rust-lang/rust-buildbot/issues/2

    We're required to rephrase old texts to fit into "gender non-binary" language. https://github.com/rust-lang/rust/pull/25640

    I'm sure they don't have problems "killing child processes" though...

    etc., etc.

    I'm not interested in using a programming language as some kind of social engineering experiment.

  5. Wake me up... by maestroX · · Score: 3, Insightful

    .. when Linus decides the next major release is to be written in Rust.
    Or for argument's sake, Mozilla itself.
    Every language has it pitfalls, at least with ye olde C/C++ I know where to look and what to expect.
    ...
    Suddenly you start to respect and embrace the get-off-my-lawn attitude, you simply want things to work rather than be written in the next greatest language of the moment.
    I think I'm ready to deal with my dad now :)

  6. Rust fans remiond me of Rush fans... by VAXcat · · Score: 3, Insightful

    They're really enthusiastic, mention that they think it's great at every opportunity, and can't understand when someone is underwhelmed by the object of their admiration....

    --
    There is no God, and Dirac is his prophet.