Earlier quoted context omitted.
If you want more details, less cruft, you probably like to read the Manual: http://doc.rust-lang.org/rust.html The Guide is fine as a tutorial and where does it not teach the basics? So your impression is definitely not mine. "Stop talkting to me informally" is also very subjective. I very much prefer the informal way.
Looking forward to reading "Rationales and design tradeoffs" section. But it's still not written: http://doc.rust-lang.org/rust.html#appendix:-rationales-and-... Is there any place to read about the Rust design?
Rust Guide
111–120 of 147 posts
Re: Rust Guide
#112Please Rust-lang, why, oh why, do you choose to name function 'fn' and module 'mod', dont you expect to read any of the programs you write!? How is anyone supposed to read fn main(). Fun main? Fen main? F of N? Is it related to ln in println? Ive tried rust, but it just doesnt parse well in my mind. More time is spent for me parseing out the bullshit terse keywords than the meaning of the program. Ada gets this right…
Re: Rust Guide
#113Earlier quoted context omitted.
On the other hand, not many languages use lowercase 'i' for complex number literals, in fact I can't think of any right now.
I can't even think of a language that has first class complex numbers, let alone complex number literals.
#include
complex f(complex a, complex b) {
return a*b + 5*I;
}Re: Rust Guide
#114Earlier quoted context omitted.
fn & mod are fine. no worse than cdr & car. Variable declaration and type annotations in rust are the thing you should be confused/angry/sad about.
Yes! This is what drives me the most crazy about rust: fn foo W>G GGW>>>F F>>A>(bar: AJK S>>>){ ... } Okay, I'm probably being a jackass, but I find Scala's use of [] for nested type annotations to be much easier to parse.
const foo = {bar: @a, baz : asd(@a,foo(@b, bar(@c,@d),int))
...
}Re: Rust Guide
#115Earlier quoted context omitted.
On the other hand, not many languages use lowercase 'i' for complex number literals, in fact I can't think of any right now.
I can't even think of a language that has first class complex numbers, let alone complex number literals.
>>> 5 + 2j
(5+2j)
>>> 2j * 2j
(-4+0j)Re: Rust Guide
#116Re: Rust Guide
#117Re: Rust Guide
#118Earlier quoted context omitted.
On the other hand, not many languages use lowercase 'i' for complex number literals, in fact I can't think of any right now.
I can't even think of a language that has first class complex numbers, let alone complex number literals.
Re: Rust Guide
#119Earlier quoted context omitted.
I understood that, but it's an unfortunate suffix.
I agree. Isn't it the default though? Could be implied when you choose to leave it out.
`5` would be signed or unsigned if left off. Depends on how you use it.
So you could try.
use std::num::abs;
let v = vec!['a', 'b', 'c', 'd'];
let x = 3;
let c = v[x]; // v.index (operator overload) constrains x to type uint.
let y = abs(x); // error: failed to find an implementation of trait core::num::Signed for uint.
// abs can't constain the type to an int because abs can take anything that
// implements `Signed` (eg BigInt)
If you wanted to make sure that x was signed. let v = vec!['a', 'b', 'c', 'd'];
let x = 3i;
let y = abs(x); // Ok as x is signed.
let c = v[x]; // error: mismatched types: expected `uint` but found `int`
If you really wanted to index to try an index with an int you can use a checked cast. let casted = x.to_uint(); // Returns None if x is negative or Some(x) if it's postive.
Also a generic int doesn't have to be int or uint, it can be any integer value: signed: i8, i16, i32, i64 or int. Unsigned: u8, u16, u32, u64 or uint.Re: Rust Guide
#120This language really interests me, but I would like to know some real world applications that are being used for it. While I may enjoy writing it as a hobby, could this be something that I utilized in production as well?