-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Closed
Labels
api-approvedAPI was approved in API review, it can be implementedAPI was approved in API review, it can be implementedarea-Meta
Milestone
Description
Background and motivation
New C# language feature adds ability to declare custom +=, -=, *=, /=, %=, &=, |=, ^=, <<=, >>=, >>>= operators, including checked forms for +=, -=, *=, /=. ECMA-335 already reserves names for non-checked assignment operators, but not for checked assignment operators.
The feature also adds ability to declare custom instance (vs. static) ++, -- operators, including checked forms.
API Proposal
Reserve the following names:
| Name | Operator |
|---|---|
| op_DecrementAssignment | instance -- |
| op_IncrementAssignment | instance ++ |
| op_CheckedDecrementAssignment | instance checked -- |
| op_CheckedIncrementAssignment | instance checked ++ |
| op_CheckedAdditionAssignment | checked '+=' |
| op_CheckedSubtractionAssignment | checked '-=' |
| op_CheckedMultiplicationAssignment | checked '*=' |
| op_CheckedDivisionAssignment | checked '/=' |
The names follow the pattern previously used for Checked user-defined operators feature.
ECMA-335 already reserves the following names for non-checked operators:
| Name | Operator |
|---|---|
| op_AdditionAssignment | '+=' |
| op_SubtractionAssignment | '-=' |
| op_MultiplicationAssignment | '*=' |
| op_DivisionAssignment | '/=' |
API Usage
The names will be used by compilers for methods implementing the operators.
Alternative Designs
N/A
Risks
N/A
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
api-approvedAPI was approved in API review, it can be implementedAPI was approved in API review, it can be implementedarea-Meta