seed-rs / seed-rs.org

Seed's official website
https://seed-rs.org/
Other
14 stars 40 forks source link

Model::default vs 0 #57

Open MartinKavik opened 4 years ago

MartinKavik commented 4 years ago

Chat - #documentation

Tock: just started working through the new docs. Am on App 1: Counter / Init. You just got done on the previous page talking about how you shouldn't implement Default for Model, then the first thing on this page I see is Model::default(). Now I know it's because it's an int alias, so we're getting i32::default(), but as someone who might have missed that, it's jarring. Maybe just have the init() return 0 directly?

MartinKavik: I was fighting with myself whether there should be: A) Model::default() B) 0 C) Change Model to something like: struct Model { click_count: u32 } because a type alias as Model is an edge-case. So perhaps we should change it to 0. Do we want to change it also in README and /examples/counter? Also it doesn't break the rule that we shouldn't implement Default for Model - it has been already implemented by Rust std..