meetings/2025/LDM-2025-04-02.md
var csharp14 = [improvement1, improvement2, improvement3]
Champion issue: https://github.com/dotnet/csharplang/issues/9101
Specification: User Defined Compound Assignment Operators.
Discussion: https://github.com/dotnet/csharplang/discussions/9100
Our first topic today is about whether we should allow a readonly modifier for compound assignments. The current specification requires the target of the operator to be a variable. In some cases, these could be beneficial - such as in wrapper classes that expose a subset of a type's surface. Also, there was concern about readonly structs needing to have all members readonly.
Full support would require additional design work.
We will allow readonly modifiers, but we will not relax the target requirements at this time.
We discussed that the implementation of user-defined operators is via methods and that behavior that did not match methods may seem strange.
Shadowing will be allowed with the same rules as methods.
This was a follow-up on concerns raised in LDM-2025-02-12. Authors may accidentally push their users into odd scenarios where a += may work, but + won't (or vice versa) because one form declares extra operators than the other.
There were concerns about enforcing such a rule.
Checks will not be done on consistency between different forms of operators.
Champion issue: https://github.com/dotnet/csharplang/issues/9174
Specification: Readonly setter calls on non-variables
Discussion: https://github.com/dotnet/csharplang/discussions/2068
There are cases where it is appropriate to error if a non-readonly setter is called, that may be reasonable when a readonly setter is called. We explored two of those cases that currently error with CS1918 Member of property ... cannot be assigned with an object initializer because it is of a value type. Should we include allowing readonly setters in these cases as part of the broader feature.
A change would be needed to the C# spec on object initializers (§12.8.16.3), which will be added to this proposal.
It was noted that expansions could be split off and done after the rest of the work in this proposal.
We will include expansions in the Readonly Setter calls on non-variables proposal