Comment on Primeagen recent video on Rust
Recently, there was a video on Rust by a popular developer/Youtuber titled:I Will Not Write Rust Again.
Link: https://www.youtube.com/watch?v=1Di8X2vRNRE
I am founder and chief rustacean of a small company:
https://www.shoestringinc.com/
I want to share a story as to how Shoestring became an all Rust company.
Everyone decided that we will switch over to Rust for everything and not just our tooling and infrastructure level software provided we meet a challenge.
We are a small company and it makes sense for our developers to be fungible across tasks. There are too many advantages to list here, the least being no spare cycles and anyone can take over any other code without fundamental retraining.And what was the challenge.
The famous Andrej Karpathy wrote an Autograd engine called Micrograd in Python and a built a neural net from scratch over it. We were going to write micrograd in Rust (link to the repo at the end of post).
Original repo: https://github.com/karpathy/micrograd
He made a superb video teaching about neural nets and maths too here:
https://www.youtube.com/watch?v=VMj-3S1tku0
The goals were:-
- Normal flow of programming without getting bogged down by famous borrow checker.
- can be used by Python developers (at notebook level) with under 1 day intro to Rust!
- code has to be written in functional style (so that Clojure and Scala guys like it).
- code looks pretty in the first uncut version itself!
- If possible, lifetime annotations should not be sticking all over!
- The engine can be hacked upon by our juniour folks.
Also some key things from Rust perspective:
- You won't find lifetime annotations!
- Remember, neural nets are a graph of massive numbers of mahtematical expressions
- So huge inter-connections and updates through out the graph and in effortless fashion just like in Andrej's Python code!
- There were no expensive cloning!
- There were no macros written (forget about PhD level ones alluded to in Youtube video)
Happy conclusion as we met all the goals and decided to use Rust 100%.
As Yukihiro “Matz” Matsumoto said about Ruby - “trying to make Ruby natural, not simple,”.
That was what was achieved.
Once I had the basic design under the belt, I was following Andrej's video and making Microgradr without my flow being broken in Rust.So here is Microgradr from Shoestring written in Rust:
https://github.com/shoestringinc/microgradr
Stick to Rust for not only great things but everything normal too.