First, some context (1/4): I tried to learn rust years ago, when there was syntax for multiple types of pointers. I'm familiar with many of its concepts, but never took the time to do something useful with it.
-
-
Prikaži ovu nit
-
Context (2/4): I've worked with multiple languages, but spent the last couple of years using js and ts.
Prikaži ovu nit -
Context (3/4): My goal is to be able to understand and maybe contribute to
@sorpaas' EVM (https://github.com/sorpaas/rust-evm …) before my gf returns, in about a week. I already work on an EVM implementation, so it should be doable.Prikaži ovu nit -
Context (3/4): I mostly work on DevEx-related projects, so I may overanalyse this whole thing
Prikaži ovu nit -
I was planning to read The Rust Programming Language, but it's too verbose. Definitely not my thing! It has a great foreword though. The empowerment thing really resonates with me. https://doc.rust-lang.org/stable/book/foreword.html …
Prikaži ovu nit -
I'll be following Rust By Example. Way more concise. Having most of the content in comments is cool. I can copy it into vscode and read and experiment from there.
Prikaži ovu nit -
Cargo seems great!! It's so fast, compared to npm. I know people complain about rustc being slow, so `cargo check` makes sense to me. I haven't dealt with dependencies yet, I hope that's not as messy as on Node
Prikaži ovu nit -
I'm a HUGE fan of
@PrettierCode, so I can't be more happy with `cargo fmt` being included in the default installation.Prikaži ovu nit -
@code support for rust looks good so far. I just installed whatever extension vscode suggested, and I'm not at all disappointed. It's not that fast, but I guess that's the language server's fault. Does@jetbrains have plans for a Rust IDE?Prikaži ovu nit -
Having a range operator is great, but two dots? WTF! Why? And `..=`? Come on! `...` would have been much more natural. Is that another operator? Does Rust have something like js' spread operator?
Prikaži ovu nit -
I'm loving the trait system so far. I've only worked with fmt things, but they seems very well thought out and tidy. I haven't made up my mind on how this compare to inheritance-based languages. I worked ~9 months with Go, and I don't remember missing classes there. We'll see.
Prikaži ovu nit -
Mixed feelings about `#[derive(Debug)]`: On one side, it's really practical, on the other one, it's too magical. I hope that's a first-class construction. It doesn't seem to be a macro, as those are applied with `!`.
Prikaži ovu nit -
Struct update syntax is cool. Not that different from the js spread operator, except it uses two dots (again! wtf
#rustlang people?) and you use it in the opposite order. I guess the order makes sense, it emphasises the new values.Prikaži ovu nit -
There's syntax for user-defined structs and tuples, and it's ok-ish. I'd love to be able to do this `let point = { x: 10.3, y: 0.4 };` instead of `let point: Point = { x: 10.3, y: 0.4 };`. I wouldn't be saving a single keystroke though.
Prikaži ovu nit -
On the other hand, destructuring is a pleasure to work with. I don't know why, but it feels much clearer than in js. It's almost the same syntax than literals, so maybe that's the reason for the limitation mentioned in the previous tweet.
Prikaži ovu nit -
I was scared that rust might force you to write things like this `let Point { x: x, y: y } = point;`, but it also accepts `let Point { x, y } = point;`!
Prikaži ovu nit -
Dead code warnings are super annoying when learning! I'm trying to disable them for my entire project, but I couldn't do it with ~3min of googling
Prikaži ovu nit -
Ok, got it! You need two global "attributes" (what's an attribute?) in your http://main.rs : #![allow(dead_code)] #![allow(unused_variables)] Thanks
@snfernandezPrikaži ovu nit -
-
IMO `try!(write!(f, "{}", value))` looks better than `write!(f, "{}", value)?` but I've only written like 100 lines of rust so far
You probably use `?` all the time in real programs, so idk.Prikaži ovu nit -
First borrow checker problem
I have so many questions rn, but first, look at this error message! I love it
pic.twitter.com/vWqNzmOtGl
Prikaži ovu nit -
So, I'm MOVING my rectangle into the rect_area function. That gives it exclusive accesss to it, I think, so `println!` can't access it. Right? But what if it evaluated the arguments in order? Is evaluation order defined? I should google it, but I'm afraid to end up in a

Prikaži ovu nit -
Also, println! is not a function, it's a macro
Maybe evaluation order is defined AFTER the macro is applied.
Macros being hard to debug is my biggest fear about rust. I hope I can see the result of expanding it somehow.Prikaži ovu nit -
To keep progressing, I fixed it by making my function take an immutable reference. I'll get back to the macros thing in the future. Do people pass arguments using & most of the time? I get why you'd do it, but I was expecting that to be automatic.
Prikaži ovu nit -
Someone answered me on IRC: yes, it's common to pass arguments with &. Thanks Alexendoo!
Prikaži ovu nit -
Someone told me I could use this to see at the macro expansion: https://crates.io/crates/cargo-expand … It took a while to install, and then it failed because I'm not on nightly. Do people use the nightly build of their compilers?
Prikaži ovu nit -
Is there an easy way to get the type of something in vscode? Now I do `let i:i32 = smth` and read the error message
Prikaži ovu nit -
-
Please someone tell me that you get used to String vs str
Prikaži ovu nit -
Defining methods can be weird at first, but it looks very similar to go. You create an `impl`ementation block and define functions that take self as their first argument.
Prikaži ovu nit - Još 334 druga odgovora
Novi razgovor -
Čini se da učitavanje traje već neko vrijeme.
Twitter je možda preopterećen ili ima kratkotrajnih poteškoća u radu. Pokušajte ponovno ili potražite dodatne informacije u odjeljku Status Twittera.
