Skip to content
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

Model::default vs 0 #57

Open
MartinKavik opened this issue Jun 19, 2020 · 0 comments
Open

Model::default vs 0 #57

MartinKavik opened this issue Jun 19, 2020 · 0 comments

Comments

@MartinKavik
Copy link
Member

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..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant