- 
                Notifications
    You must be signed in to change notification settings 
- Fork 6.1k
Updated default.md #4993
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
Updated default.md #4993
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for updating this @pkulikov
Overall, it's much clearer. I had one comment, and one question for you.
| - [The switch statement](switch.md): Specifies the default label. | ||
|  | ||
| - [Default value expressions](../../programming-guide/statements-expressions-operators/default-value-expressions.md): Produces the default value of the type. This will be null for reference types and zero for value types, and the 0 bit pattern for structs. | ||
| - [Default value expressions](../../programming-guide/statements-expressions-operators/default-value-expressions.md): Returns the default value of a type: `null` for reference types, zero for numeric types, and zero/`null` filled in members for struct types. | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to keep the term "Produces" instead of "Returns". Yes, this is a bit pedantic, but expressions don't "return", they are evaluated. Evaluation of an expression produces a result.
Another question: With the new wording, do you think nullable types need to be called out? They weren't earlier, and it both versions, the behavior for default(int?) is hinted at but not stated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@BillWagner as for "Produces", I see your point and agree. Will update it and thank you for the clarification.
As for the explanation text, I've thought about removing it at all and having just Produces the default value of a type. Thus, inviting a reader to follow the link (I'll make another PR to update the actual topic that describes default value expressions) that provides more details. As for now, there are three places in docs where we explain default type values. What do you think of it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And question: is it possible that folks think of int? as a numeric type? If yes, then they might misread the text.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As for now, there are three places in docs where we explain default type values. What do you think of it?
Yes. I like that idea.
is it possible that folks think of int? as a numeric type? If yes, then they might misread the text.
It is. That's the best case for calling it out explicitly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@BillWagner I've updated both pages. Please check, if we understood each other correctly. The default value expression page -> another PR.
| @BillWagner tagged as changes-addressed for you to verify your feedback was taken care. Thx! | 
| Thanks for making the update @pkulikov  I'll  Thanks again. | 
 now.
 now.
Removed not necessary first line.
Updated description of the default value expression to the one used in the C# Operators topic.