One thing I’m appreciating since branching out into #rustlang and using #data.table at work is that immutable data by design is an incredibly useful simplification that reduces cognitive load and eliminates large classes of bugs in #rstats.

I can’t recommend packages that try to give users the power of mutability. While the benchmarks are seductive, you don’t gain time because of the new weird bugs and constant struggles over what parts of your API should allow mutability.

You can’t easily signal mutability in an API in a dynamic language like you can in a typed one like Rust.

And there are all sorts of problems that come with interfacing with tools that assume copy on modify is in effect, when actually you can modify things they hand you and break internal assumptions. This cropped up a bit with data.table + {targets}

And on the subject of {targets}, IMHO it’s a more general and effective solution to “my code is taking too long” than buying into mutable data.

@milesmcbain more generally, pure functions are easier to understand and trust.

It’s great that rust is immutable by default. You need to signal something is mutable explicitly, instead of signalling something is constant.

@milesmcbain Any fave rust learning resources?
@dataandme coming from R I am of course primed to treat official documentation with extreme prejudice, but ‘The Book’ has been really great. https://doc.rust-lang.org/book/
The Rust Programming Language - The Rust Programming Language

@milesmcbain @dataandme Have you tried rustlings? I started it with moderate scepticism but found that it does a really good job of harnessing the mini high you get from solving a problem, and does so without being overly restrictive too.

https://github.com/rust-lang/rustlings

GitHub - rust-lang/rustlings: :crab: Small exercises to get you used to reading and writing Rust code!

:crab: Small exercises to get you used to reading and writing Rust code! - rust-lang/rustlings

GitHub
@_wurli @dataandme I have not yet. With that endorsement I may check it out soon. I do have a well defined project I am keen to get started on using Rust though so my plan is for that to be my baptism of fire after I’ve done my reading.
@milesmcbain @dataandme No better way to learn than to find something you want to achieve, then achieving it 💫

@milesmcbain @dataandme the book is great, I also got a lot out of Rust for Rustaceans

https://rust-for-rustaceans.com/

Rust for Rustaceans

For developers who’ve mastered the basics, this book is the next step on your way to professional-level programming in Rust. It covers everything you need to build and maintain larger code bases, write powerful and flexible applications and libraries, and confidently expand the scope and complexity