Live data from Hacker News

Why scientists are turning to Rust (2020)

nature.com

11–20 of 55 posts

Re: Why scientists are turning to Rust (2020)

#11
post #7

Are they? I worked with bioinformaticians and now physicists and rust has never come up. > Köster, now at the University of Duisburg-Essen in Germany, was looking for a language that offered the “expressiveness” of Python but the speed of languages such as C and C++. In other words, “a high-performance language that is still, let’s say, ergonomic to use”, he explains. What he found was Rust. He must not have looked v…

Rust seems to get serious corporate support, which future-proofs it and guarantees ecosystem growth. Not sure about Nim.

Edit: others mentioned Julia, and it indeed looks like a valid choice since they don’t seem to program embedded or safety-critical stuff.

Re: Why scientists are turning to Rust (2020)

#12
Good question then: how is the "occasianal's programmer" experience compare between Rust and C++?

I used to write games in C++ as a teenager, and using it daily was fine. Now I find, every time I try to write something in it, it's a massive pain, as I forget the myriad of tiny rules, the very specific ways to write types etc. And that's before I even think about dependency management.

Is Rust substantially better at this? When I read frustrations about Rust, it seems to be mostly about the Borrow Checker... does that affect "pedestrian" code, like "take this 4-dimensional array and munge it with an arcane for-loop"? Or, here's a basic immutable class with some fields and some methods, make it available in Python?

I'm liking the look of Nim because it is concise, safe and fast-ish, so a good companion to Python. I dislike C++ as that companion because, even though once you've written your code, it integrates very well with Python, it's a lot of pain to get there. Where would Rust fit in this picture?

Re: Why scientists are turning to Rust (2020)

#13
>>“No other mainstream languages really have these concepts, and they’re really core to understanding a lot of how you have to write code in Rust,” Nichols says.

I tried Rust, but I am using SPARK2014/Ada for my needs. Easier to learn and has the formal methods/software integrity checks and other niceties. I started learning SPARK2014 while reading the book, "Building High Integrity Applications with SPARK". It was used by the CubeSat lab in Vermont [1], which the book ties in nicely. I can see programmers flocking to Rust, but scientists are not typically computer scientists, and mainstream shouldn't be a highly-weighted metric. I find Rust a lot more heavy than SPARK/Ada. I've tried Julia too, but you can write systems level code in SPARK/Ada too. The adacore site has a lot of great projects and articles on embedded software, drone low-level code rewrite in SPARK, etc.

The partnership between AdaCore and Ferrous Systems is very exciting [2]. I hope to be able to stay with SPARK and gradually learn Rust with this partnership when Rust has a bit more under its belt with real world embedded, high-integrity software like Ada's legacy.

[1] http://cubesatlab.org/

[2] https://ferrous-systems.com/blog/ferrous-systems-adacore-joi...

Re: Why scientists are turning to Rust (2020)

#14
Yeah no, "scientists", this wonderful general category that means nothing and everything, in general, are not turning to Rust.

Programming is a niche. Rust is a, albeit amazing and gaining traction at a fast pace, niche in this niche.

99% of mathematicians, physicists and biologists I have worked with have not even tried programming yet. And if they do, they will start with the stuff their friends are already using: python, fortran, etc.

Hell, 99% of the dev have not heard of rust yet. I go from companies to companies, every time I talk about rust, I have to explain what it is.

It's not even living in a bubble if you think that, it's living in an bubble from another dimension.

Having generalization from anecdotal evidence in nature.com is kinda ironic if you think about it.

Re: Why scientists are turning to Rust (2020)

#15
post #6

Field specific, to be sure, but I know literally zero scientists turning to Rust.

Yeah. I have one physicist friend, and as I far I know from casual conversion with them, the whole team at his lab don't even know if they are writing C or C++. And explaining python to him, because he's required to teach a bit of it, was a rabbit hole of explaining fractal things.

My impression is that at least a number of scientists don't know and don't care.

Re: Why scientists are turning to Rust (2020)

#16

Good question then: how is the "occasianal's programmer" experience compare between Rust and C++? I used to write games in C++ as a teenager, and using it daily was fine. Now I find, every time I try to write something in it, it's a massive pain, as I forget the myriad of tiny rules, the very specific ways to write types etc. And that's before I even think about dependency management. Is Rust substantially better at…

Rust users are very enthusiastic about Rust, because it fixes so much annoying shit you have to deal with in C/C++. It really brings back a lot of joy to programming.

The borrow checker is an issue when you are a beginner and have to unlearn all the bad practices you were doing in C/C++.

Re: Why scientists are turning to Rust (2020)

#17

Good question then: how is the "occasianal's programmer" experience compare between Rust and C++? I used to write games in C++ as a teenager, and using it daily was fine. Now I find, every time I try to write something in it, it's a massive pain, as I forget the myriad of tiny rules, the very specific ways to write types etc. And that's before I even think about dependency management. Is Rust substantially better at…

> Is Rust substantially better at this? When I read frustrations about Rust, it seems to be mostly about the Borrow Checker... does that affect "pedestrian" code, like "take this 4-dimensional array and munge it with an arcane for-loop"? Or, here's a basic immutable class with some fields and some methods, make it available in Python?

I think language complexity in general is not a problem; language consistency is. I find Rust complex, but not inconsistent or surprising (with exceptions). I'd say that yes, it is substantially better in this regard.

Regarding the "pedestrian code", it depends. Rust is very unergonomic for algorithms, due to its handling of bidirectional references. However, some algorithms/data structures may work fine; the matrix operation you refer to can be very easy to work with, if the elements are Clone/Copy, which numbers are.

I'm a Rust fan, but the article seems to be a puff piece; it takes one case and generalizes it. I also think that Rust is not productive [than other easy, compiled, languages] for generic programming, at least, without significant experience. Relatively small programs (I don't know the size of the typical scientific programs in academia) may be easier, but once a program grows, it definitely requires an amount of design (due to ownership) that other languages don't require.

Re: Why scientists are turning to Rust (2020)

#18

Good question then: how is the "occasianal's programmer" experience compare between Rust and C++? I used to write games in C++ as a teenager, and using it daily was fine. Now I find, every time I try to write something in it, it's a massive pain, as I forget the myriad of tiny rules, the very specific ways to write types etc. And that's before I even think about dependency management. Is Rust substantially better at…

> the Borrow Checker... does that affect "pedestrian" code

Unfortunately, the reason why you hear complaints is because it does affect even normal code. Writing code in a setting where you have a strict type system is like writing a mathematical proof. You know that the thing you want to do is safe/correct/valid, but you have to find a way to write it formally, which is itself kind of a puzzle.

Don't get me wrong, I think stricter type systems are the future of programming, except maybe for very high level stuff like Python and Js, but there's definitely some friction involved when the language is a "puzzle language" that insists you do things in a specific way.

With Python or C++, most experienced programmers will be able to bang out just about anything.

With Haskell, Rust, Idris, OCaml and the like, there's this additional step of writing a very detailed math proof that your code is actually allowed. Which makes a lot of sense when you think about those languages' goals.

> Where would Rust fit in this picture?

There's PyO3, not as stable as pybind11 but it's getting there. Honestly Python is just great for stuff like this. You have a lot of ways to gradually speed it up (types -> cython, C++, Rust). It's about as elegant as an octopus made stapling extra legs to a dog, but it's hard to argue it's not effective.

Re: Why scientists are turning to Rust (2020)

#19

Good question then: how is the "occasianal's programmer" experience compare between Rust and C++? I used to write games in C++ as a teenager, and using it daily was fine. Now I find, every time I try to write something in it, it's a massive pain, as I forget the myriad of tiny rules, the very specific ways to write types etc. And that's before I even think about dependency management. Is Rust substantially better at…

> Is Rust substantially better at this? When I read frustrations about Rust, it seems to be mostly about the Borrow Checker... does that affect "pedestrian" code, like "take this 4-dimensional array and munge it with an arcane for-loop"? Or, here's a basic immutable class with some fields and some methods, make it available in Python? I think language complexity in general is not a problem; language consistency is. I…

> I think language complexity in general is not a problem; language consistency is.

With C++ I do find human medium-term cache capacity to be an issue. By the time I use C++ again, I forget some of the many little things I need just to compile a glorified "fizz-buzz". Things like, is this a pointer to a const or a const pointer? What's the syntax for a move/copy constructor? Keeping headers and cpp files in sync. What's the flag to enable modern C++ extensions? How do I write this lambda? Or make a pointer to a function? And so on...

Re: Why scientists are turning to Rust (2020)

#20

Good question then: how is the "occasianal's programmer" experience compare between Rust and C++? I used to write games in C++ as a teenager, and using it daily was fine. Now I find, every time I try to write something in it, it's a massive pain, as I forget the myriad of tiny rules, the very specific ways to write types etc. And that's before I even think about dependency management. Is Rust substantially better at…

I'd say that Rust is better in many regards (the kinds of things you described will mostly Just Work), but there's still enough surface area that you might forget bits if you haven't touched it in a while.

One notable difference, though: in C++, if you forget a detail, you might get a compilation error or you might get a runtime crash and need to pull out something like valgrind. In Rust, if you forget a detail, you're extremely likely to get a compilation error, not a runtime crash.

Post reply on HN