I'm a newbie to rust but have programmed in other languages (c, c++), i've read the book (the newer one), and have a bit of difficulty on the new terms but i fully understood the borrowing concept
I've been a strong believer that in order to understand more another new language, i want to see it side by side to another popular language to fully understand it...
do you know of another site that have this kind of comparison? i mean not the basic stuff, but the more advanced ones? like...
how to define a global variable (if possible)
how to dynamically allocate an object (struct in rust) and being able to control when to destroy it (allocate to a vector perhaps) (if possible)
pointers (if possible in safe rust)
i really want to learn rust, but sadly it has a steep learning curve, even for an experienced programmer, rust aint easy, i feel that the documentation (the book) can benefit if there are some comparisons to other language to facilitate the transition (like match is a c/c++ switch statement, closures are similar to lambdas, etc)
i know rust is powerful (hence i want to learn it), i know i have to bend my thinking a little bit (what i used in other languages, i can't do in rust), i want to learn it, i've read the book several times but sometimes the new technical jargon, i don't fully get it...
also I just wanted to ask this, I want to learn rust to port my c++ program to rust (to learn so i understood the concepts), is it possible to save state in rust? literally create an object dynamically which saves state...(sample socket server app), i open a socket and i need to save some state, that will have a lifetime that of the client?
This is a great problem you bring up, although I'm unsure of a solution. I'm a self-taught guy and I had only a very high-level understanding of the tools I used (mainly Ruby). Rust introduced concepts I've never heard before, so I couldn't really do much comparison. Rust is fairly different in many ways, especially without prior knowledge of other languages descended from ML. Enums really tripped me up when I first started.
I'm not sure if there's a great way to compare without the reader understanding those concepts in the first place.
You're right, I'm also a self taught guy, in a traditional sense of programming, I find that the borrowing schemantics of rust is the only one being different (as far as i know) from other languages, and this creates problems when passing data through functions, multiple threads, which your used to do in other languages...In rust you need to know the flow of data such that only one is owner...(correct me if I'm wrong)