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

Provide rationale for defaultability #13

Closed
wingo opened this issue Jul 13, 2017 · 6 comments
Closed

Provide rationale for defaultability #13

wingo opened this issue Jul 13, 2017 · 6 comments

Comments

@wingo
Copy link
Contributor

wingo commented Jul 13, 2017

It seems that defaultability is an unneeded wrinkle -- it's always known when allocating a struct which fields will have default values, and they can just be given in the source program. I can only think that defaultability is a space-saving measure; but is it that important? If so, consider augmenting the spec to indicate the rationale for this feature.

@rossberg
Copy link
Member

The existing numeric types are defaultable today (for locals), so there has to be at least a minimal notion of defaultability and corresponding type distinction. And once that exists, there doesn't seem to be a strong reason not to introduce the natural extension to new types. As you observe, it can save some space.

@wingo
Copy link
Contributor Author

wingo commented Jul 13, 2017

I think I missed the defaultability aspect of the existing types. Given that, I think it's just my ignorance and no more words need be spent :) Closing this bug.

@wingo wingo closed this as completed Jul 13, 2017
@titzer
Copy link
Contributor

titzer commented Jul 17, 2017

I actually agree with @rossberg-chromium, but there might be design alternatives that allow us to add types that do not have default values. E.g. non-default values might be crucial if we add sum types later.

To motivate us to explore such design alternatives, I think we should reopen this issue--but just to add a blurb that explains the current rationale (if nothing more than a TODO to think this through a bit later).

@titzer titzer reopened this Jul 17, 2017
@rossberg
Copy link
Member

@titzer, not sure what exactly you are suggesting. The proposal already states that both defaultable and non-defaultable types exist.

@titzer
Copy link
Contributor

titzer commented Jul 18, 2017

Sorry, yes, I realized this after posting the comment above.

@binji
Copy link
Member

binji commented May 27, 2020

Seems like this issue was addressed, closing.

@binji binji closed this as completed May 27, 2020
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

4 participants