Rust programming language


#1

Has anyone heard of Rust? What are your thoughts on this new programming language?


#2

Ain’t sure but it isn’t new, yes ? Go is more recent AFAIK.
Anyway, never tried to use it, but based on the small, unrepresentative amount of line i’ve seen, seems kinda messy. Just my 2 cents though.


#3

Oh I see.

their for loops are completely fucking retarded.

C-like syntax for loop:

for (int i = 10; i < 0; i -= 2)
{
    // Does something
}

How the hell do you do something like that for Rust when it is more like

for 0..10
{
    // Does something
}

??


#4

The documentation seems quite good:

https://doc.rust-lang.org/1.1.0/book/for-loops.html

Anyway I prefer the Rust version although C’s syntax is just like Plan9’s rc shell:

; for(i in one two three) echo $i
one
two
three
;

I like that because it’s quicker to type than the Bourne-style shell loops :slight_smile:


#5

THat looks confusing to be honest lol.


#6

I guess it’s just like any other programming language, once you get used to it… ¯\(ツ)
I remember when I started programming in Perl, I couldn’t get use to the 3 types variables only, with dedicated pointer on each. It just took me some time to make it become natural, now I don’t feel like it’s hard anymore.


#7

Oh I see mate.


#8

One way to do it is like this:

for element in (0..=10).rev().step_by(2) {
    // Do something
}

I’ll admit that it does look weird, with ..= (which denotes an inclusive range) and having to reverse the range and all that.


#9

THanks for that :slight_smile: