Conversation
|
@dotnet/roslyn-compiler for review (spec change). |
|
|
||
| * A protected constructor taking a single argument of the record type. | ||
| * A constructor taking a single argument of the record type, referred to as the "copy constructor" | ||
| * A public parameterless virtual instance "clone" method with a compiler-reserved name |
There was a problem hiding this comment.
clone [](start = 43, length = 5)
This should probably be italics instead of quoted.
proposals/records.md
Outdated
| fields of `this`. | ||
| #### Copy constructor | ||
|
|
||
| If a user-defined copy constructor is present, it is used instead of a synthesized one. It must use |
There was a problem hiding this comment.
present [](start = 38, length = 7)
Not sure what "present" means. Is this intended to overrule the text from the enclosing section "Members are synthesized unless an accessible concrete (non-abstract) member with a "matching" signature is either inherited or declared in the record body." or is it intended to be a restatement? If a restatement, I suggest "declared". #Resolved
There was a problem hiding this comment.
Thanks. Removed the unnecessary restatement, keeping the new portion. #Resolved
| fields from the record itself: | ||
| 1. If the record derives from `System.Object`, the copy constructor invokes the default constructor on the base type. | ||
| Otherwise, it invokes the copy constructor on the direct base record, passing its argument through. An error is | ||
| produced if that base copy constructor is not accessible. |
There was a problem hiding this comment.
. [](start = 56, length = 1)
These options are not exhaustive. What if it extends a non-record type?
There was a problem hiding this comment.
We only allow deriving from object or a record at the moment. Further LDM discussion may change that.
There was a problem hiding this comment.
There is no such constraint in this specification. Please either add that constraint or fix this section to account for its absence.
In reply to: 438205208 [](ancestors = 438205208)
proposals/records.md
Outdated
| Otherwise, it invokes the copy constructor on the direct base record, passing its argument through. An error is | ||
| produced if that base copy constructor is not accessible. | ||
| 2. The copy constructor then copies the values of all the instance fields in the input record to the corresponding | ||
| fields of `this`, considering only the fields declared by the record. |
There was a problem hiding this comment.
declared [](start = 46, length = 8)
"declared" is used as the opposite of "synthesized" elsewhere. Should this be "synthesized or declared"? #Resolved
There was a problem hiding this comment.
Fixed. I'm mainly trying to oppose to inherited fields (those are handled by the base copy constructor). #Resolved
|
It looks like some of the similar changes were already made in an earlier PR |
| fields of `this`. | ||
| #### Copy constructor | ||
|
|
||
| If a user-defined copy constructor is present, it must use the base's copy constructor as its |
There was a problem hiding this comment.
present [](start = 38, length = 7)
Still think this should be "declared".
No description provided.