3 ms·
Ah yeah, the second edition is just straight-up better, and does contain examples. For example, ownership, references, and borrowing are theory-based in 1st edi
by steveklabnik 9y ago
Ah yeah, the second edition is just straight-up better, and does contain examples. For example, ownership, references, and borrowing are theory-based in 1st edition, but are with String/&str in the second. That said, both are great resources. For some people, the book doesn't work for them but RBE does, and for others, RBE doesn't but the book does.
- pjmlp 9y agoI went through the books, yet it was a big challenge porting an old Gtkmm toy application to Gtk-rs, because of lifetimes on callbacks. Initially I was referring to the fields on the struct, but ended up passing them around as parameters. You have a referrence to this kind of problem on the NLL proposal. But unless I missed it, the books don't talk much about this.
- steveklabnik 9y agoThe book does, but it basically says "Don't do that", whereas since you're binding to a library that does that, you don't have a ton of choices. I haven't really used Gtk-rs enough to say more than that, really.
- pjmlp 9y agoBasically the idea of having structs implementing widgets, which need to respond to UI events and handle their state, stored as struct fields. On modern C++ you can easily use this approach with std::enable_shared_from_this.