Rust

Datetime:2016-08-22 23:59:58          Topic: Rust           Share

Rust is what is known as a systems programming language. This means that generally speaking it is used to write code that will spend more time talking to computer hardware than normal application software might.

This means you will get more direct access to the machine than you would with say a programming language like Ruby.

Functional and Procedural

I will explain both these terms in more detail in other sections of this series, for now here is what you need to know;

The functional part is just like if you did functions at school. You have some input into a formula and some output from the formula.

The formula never changes the input so you can always be sure that if you give the same input 100 times, the same output will appear 100 times.

The procedural part is fairly similar, it basically means that we write our code in chunks that are meant to be run in a particular way.

We we might have 6 procedures and they can be called when we need them. These procedures don’t have any special access to data that isn’t passed into them, much like formula in school you need to feed it all the inputs.

Compiled

Rust is a compiled language – this means that before you try and execute your code you need to compile it ahead of time. This means taking the code you have written and running it through another program which can turn your code into machine code (code which can be read by machines).

Rust is quite interesting because the Rust compiler is written in Rust. This means that when you run the steps to turn your code from something you understand to something the computer understands, the code that does that transformation is itself Rust.

Example

Here is the common “Hello, world!” example in Rust.

fn main() {
  println!("Hello, world!");
}

Here we see a function called main (which we can deduce is the main program we want to execute) and it is calling another function called println! . From other programming languages I know this stands for Print Line. And then we have the string “Hello, world!”.

It is one of the less intimidating Hello, world! examples I have seen.

Popular

Rust is popular and the community seems to be growing in number and in voice continually. There is a well used Rust Subreddit and plenty of questions and answers on Stack Overflow





About List