From Julia to Rust
The article outlines the author's transition from Julia to Rust, highlighting Rust's memory safety features, design philosophies, and providing resources for learning, while comparing code examples to illustrate syntax differences.
Read original articleThe article discusses the author's journey from learning Julia to exploring Rust, highlighting the differences in philosophy and design between the two programming languages. The author emphasizes the importance of Rust in addressing memory safety issues prevalent in large tech corporations, citing talks that illustrate the urgency of adopting safer programming practices. Rust's ownership model and borrow checker are presented as solutions to common pitfalls in systems programming, contrasting with Julia's focus on performance through multiple dispatch and JIT compilation. The author provides a brief historical context for both languages, noting that Julia emerged from frustrations with existing scientific computing tools, while Rust was developed to improve productivity in low-level systems programming. The article also includes a list of resources for learning Rust, emphasizing the need for a structured approach to grasp its complexities, such as generics and traits. The author concludes by comparing code examples in both languages, illustrating the additional boilerplate required in Rust for achieving similar functionality to Julia, which is more concise and flexible. Overall, the piece serves as a guide for Julians interested in transitioning to Rust, outlining the benefits and challenges of the shift.
- The author is transitioning from Julia to Rust, motivated by Rust's memory safety features.
- Rust's ownership model and borrow checker help prevent common programming errors.
- The article provides historical context for both languages and their design philosophies.
- A list of resources for learning Rust is included, emphasizing structured learning.
- Code examples illustrate the differences in syntax and complexity between Julia and Rust.
Related
I Hope Rust Does Not Oxidize Everything
The author expresses concerns about Rust's widespread adoption in programming, citing issues with syntax, async features, complexity, and long compile times. They advocate for language diversity to prevent monoculture, contrasting Rust with their language Yao.
Investing in Rust
Investing in Rust programming language can enhance cybersecurity by preventing memory-related vulnerabilities. Challenges in adoption include integration issues and skill set mismatches, suggesting U.S. policy interventions for promotion.
Rustgo: Calling Rust from Go with near-zero overhead
An experiment explores calling Rust code from Go to enhance performance in critical applications. It proposes linking Rust directly into Go, avoiding cgo overhead, and details calling conventions for efficient integration.
Don't write Rust like it's Java
The author discusses transitioning from Java to Rust, highlighting Rust's type safety, differences in traits and interfaces, complexities of ownership, and the importance of embracing Rust's unique features for effective programming.
Profiling Programming Language Learning
A year-long study on Rust programming revealed early dropout rates due to challenging concepts. Conceptual quizzes improved scores by 20%, suggesting the methodology could benefit other languages with smaller audiences.
I have no idea why this blog is making the rounds again and I've learned a lot of Rust since, see my (badly benchmarked!) presentation at this year's Scientific Computing in Rust 2024:
https://www.youtube.com/watch?v=bdsBhqKOe7A
and a PR I sent in for the Rust compiler to speed it up for some low hanging fruit:
https://github.com/rust-lang/rust/pull/110477
I'll have to revisit this blog at some point and see what I should update, as well as a "From Rust to Julia" post for those that want to venture into that world as well.
Other thoughts: Developing Rust on Windows is painful but on Linux a joy. both cargo and Julia package managers are wonderful compared to other language alternatives.
The nicest way to avoid the "oh a lot of boilerplate!"-problem with implementing "Add" for a custom type is by using the "derive-more"-crate. Then you simply put a "#[derive(Add)" above your struct. That was the initial reason I switched to Rust myself: because I was writing a dynamical systems solver in C++ and had to overload arithmetic operators for my state-struct. But doing this was so complicated and I never felt sure of it performance wise (what if one side is a reference? And so on).
In rust I have a macro and don't have to ever worry about that again.
That's not really the case. For loops are certainly less common compared to C, but they are completely fine to use. Forcing every loop into an iterator-chain style can sometimes be more confusing.
Not to mention doing for-iterations with early exits. Yes, you can use try_fold, but if I'm not writing generic iterator library code, I'd prefer explicit for in cases like this.
> writing Fortran-ey code instead of iterators will lead to pain and slower loops.
No it won't. At least not in the general case. Not to mention that iterators also have performance footguns that are pretty easy to trigger.
Interesting post, even though I don’t understand “Why Rust” because all the reasons cited are not an issue with Julia (eg memory safety).
This seems to not be about Julia at all. It just a post of a person who only knew Julia, and is now wanting to learn another language (which happens to be Rust)
Add new builtins to Bash using a shared library (or .bundle on macOS) written in Rust. Bash also allows running bash other commands from native code. (There's a rust crate for creating bash builtins, but it doesn't currently compile on mac due to some improper and some missing linker flags.)
Related
I Hope Rust Does Not Oxidize Everything
The author expresses concerns about Rust's widespread adoption in programming, citing issues with syntax, async features, complexity, and long compile times. They advocate for language diversity to prevent monoculture, contrasting Rust with their language Yao.
Investing in Rust
Investing in Rust programming language can enhance cybersecurity by preventing memory-related vulnerabilities. Challenges in adoption include integration issues and skill set mismatches, suggesting U.S. policy interventions for promotion.
Rustgo: Calling Rust from Go with near-zero overhead
An experiment explores calling Rust code from Go to enhance performance in critical applications. It proposes linking Rust directly into Go, avoiding cgo overhead, and details calling conventions for efficient integration.
Don't write Rust like it's Java
The author discusses transitioning from Java to Rust, highlighting Rust's type safety, differences in traits and interfaces, complexities of ownership, and the importance of embracing Rust's unique features for effective programming.
Profiling Programming Language Learning
A year-long study on Rust programming revealed early dropout rates due to challenging concepts. Conceptual quizzes improved scores by 20%, suggesting the methodology could benefit other languages with smaller audiences.