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

assignment #5

Open
tvaneerd opened this issue Jul 20, 2017 · 0 comments
Open

assignment #5

tvaneerd opened this issue Jul 20, 2017 · 0 comments

Comments

@tvaneerd
Copy link
Owner

When is it OK for assignment to be implicit but construction explicit?
Howard and I both think "not usually, but sometimes", but have no hard rules.

eg. zoned_time = local_time sets the local-time portion of a zoned_time. Is that OK?

StringId isn't convertible from string (to avoid accidental passing a string when you want an ID)
but StringId = string seems like there is intent, and it is not accidental.

Whereas milliseconds = int is probably too dangerous.

For units like milliseconds, the int represents a measure in some unit - the question is "is it the right unit"

For StringId = string, there is only one meaning - set the internal string. Could the string be in the wrong "unit"? Less likely?

zoned_time = local_time still seems scary to me - there are two (equally) valid meanings - just set the time portion of zoned_time, or convert from that time in the local time zone into the simultaneous time in the zoned_time's time zone.

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