Nevermind, rust is fine for experimenting
Posted on by smashedtoatoms
So I decided on Rust over Common Lisp for Advent of Code. I read up on inline testing and decided it would be fun to see what I could do. Testing instead of repl has the amazing side-effect of leaving tests behind as artifacts. What’s not to like?
First off, the tooling is fantastic. VsCode with rust-analyzer is great. It took me basically no time to get up and running. I had to read up on workspaces, but it’s been pretty straightforward once I got that sorted. As it turns out, the repl is a lot less necessary when you write your tests in your source files. Maybe it sucks on larger projects, but I am finding it to be pleasant. My concerns about being unable to experiment have been unfounded.
The language itself is a lot easier to figure out than I had been lead to
believe. This is wrong. The second I started not using unwrap
and started
trying to properly handle errors, it got harder The docs are great too. I am
sure I am doing everything wrong, but so far, it’s been a lot of fun. This
is also less true after trying to handle errors correctly. I have no time to
solve actual problems because all my time is spent battling the borrow checker.
I do find myself going with a more imperative style. Functional programming with
maps and filters is fine, but the folds I was doing got pretty gnarly looking.
If the imperative style is safe, it seems like I can go with whatever is the
easiest to read. I suspect it all compiles down to the same thing either way.
Anyway, I am falling behind because I keep refactoring as I discover new things and an not smart enough to use this language. I keep experimenting when something catches my attention. You can check it out here if you want to see how far I have gotten. When AOC is over, I’m going to build something real in it.