-
Notifications
You must be signed in to change notification settings - Fork 3.6k
suggestions on 2nd edition #773
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Do you mean roughly speaking? I'd assume it's roughly that the index goes wherever it avoids disrupting alignment, no? As for the actual rules, I think |
Yes, it is roughly speaking. Actually I am not talking about Rust lang, instead I just want to share my proposals to the Rust book. IMHO, many pure C/C++ programmers are very familiar with C memory model, C++ OO, C++ template, STL and boost etc, and some other languages e.g. Python/Java, while they don't have chance to take a look on languages like Haskell, OCaml etc only because they don't need it in work. Especially some of them are system level developers, who cares about cache missing, bytes alignment, MP/MT programming etc. Now Rust is suppose being a better substitution of C/C++, maybe the book could assume some of readers are them to smooth the learn curve for them. |
Thanks for these comments!
So, technically speaking, enum layout in Rust is unspecified, so we can't actually say. As @burdges points out, even the current implementation has a bunch of complexities, but we don't get into that level of detail in the book, as none of that is stuff you can rely on.
We tried to cover this in the OO chapter, maybe we didn't do a great job. |
Thanks, now I understand what you said regarding "enum" stuffs. Wish more developers turn to Rust. |
I'm going to close this-- please take a look at chapter 17 for some examples about what to use instead of inheritance and reopen this if you have any ideas for improvement! https://doc.rust-lang.org/nightly/book/second-edition/ch17-00-oop.html |
The 2nd edition is really much clear than 1st one. I love it.
Here are my suggestions,
Since it is not an issue, please feel free to close it if accept or not.
Thanks,
R.N
The text was updated successfully, but these errors were encountered: