So I’ve been programming for a while, I started with Basic, then C/C++ on to Java/Groovy, ABAP, Python then now JavaScript. I learned something new with each new language and I wanted to keep that going.
Recently I gave a talk about JavaScript build tools and talked about why some of those are switching over to rust. When I gave that talk I knew absolutely nothing about the Rust programming language, but during research, I really got interested in Rust and decided to learn it.
So to keep myself accountable and as a form of note-taking, I’ll blog about what I learn here.
Now I’d love to say this will be daily but let’s be honest, I have a day job, a 5-year-old, and a life so more likely it will be weekly.
Let’s dive in.
First Thoughts
Installation was painless, but I’m on Linux, so nothing weird there. I just ran
$ curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf | sh
Code language: JavaScript (javascript)
And that was it.
The hello world program
fn main() {
println!("Hello, world!");
}
Code language: Rust (rust)
So I’m guessing the fn is the rust equivalent of js’s function
. The println
is nostalgic from my c/c++ days but what’s up with that that exclamation mark(!)
Programs start from main, c++ again, and are compiled. It’s going to be weird since for the last few years I haven’t been compiling programs.
But whatever, moving on…
It also turns out we have a code formatter, rustfmt
. This is awesome because ESLint and StandardJs left their mark on me.
I usually don’t use semi-colons in JavaScript, thanks StandardJs, but they are required now. Apparently, they can be omitted in some instances but we’ll get to that another time I hope. I also found out the meaning of the !
at the end of the function, another thing that may need its own article.
Finally today I learned the word Rustacean. Apparently, it’s a person who uses, contributes to, or is interested in the development of Rust. So since I wrote “hello world” apparently I’m now a Rustacean, lol.
That was day one, nothing happened. Are you a Rustacean? Say hi on Twitter @phoexer, and happy coding.