DEV Community

Adam Crockett 🌀
Adam Crockett 🌀

Posted on

Rust log: First chapter

It's my first step into rust, I have been watching rust for a while and wondering how does anyone get to learn this, the syntax coming from JavaScript / Typescript is quite bezare.

I wrote a WASM project which is 90% done Lua VM for node Js, I spent more time learning modern c++ than I did actually writing any Lua. This was enormously challenging and fun.

Although that project is important to me, it's not gona help anyone unless Lua has an upsurge or a game studio wants to make a game in node and Lua. I will finish this project but I'm also working on Jess and Tess, after a very good reaction here from the community I have started writing a cli for Jess in rust.

My first day I used a framework called clap to parse args, I don't have time to write some cli library, I need to get an MVP shipped. I got stuck pretty quickly trying to validate if the Jess file existed. It was frustrating because in node I could do this in one line and handle lots of edge cases. Rust it turns out prevents you from writing poorly memory managed code and generally bad code, but if you're learning, this is a nightmare. I found myself shouting "I hate you rust you fantastic peace of s***!", because in the end it wasn't rust that was at fault it was me.

I sat down and learned about borrowing and ownership, Now things are heating up armed with that knowledge, I highly recommend you do the same because it's not that painful, I have made a working cli that has design principles I wouldn't have even thought of had it not been for the strictness of rust. I'll keep you posted how things progress.

Top comments (3)

Collapse
 
ivanalejandro0 profile image
Ivan Alejandro

"I hate you rust you fantastic peace of s***!"

Oh, I feel you :)

Collapse
 
adam_cyclones profile image
Adam Crockett 🌀

I'm really starting to enjoy it. I certainly haven't spent this much time in the docs of any other language sinse my first language. But atleast the docs are pretty fantastic, I would have given up by now otherwise.

Collapse
 
ivanalejandro0 profile image
Ivan Alejandro

Oh, yeah... the docs are certainly great.
I spent a lot of time on the docs too, mainly on "the book"... but I think it is unavoidable since the borrow checker and ownership is a concept you don't see on other languages and you need to learn about that to start reading/writing code.
I'm looking forward to the "enjoying writing rust" stage. So far, with a handful of days in on rust, I'm already starting to feel comfortable reading other people's code.
Thanks for sharing your thoughts on working with Rust, cheers!