Back to Csharplang

C# Language Design Meeting for October 28th, 2024

meetings/2024/LDM-2024-10-28.md

latest2.0 KB
Original Source

C# Language Design Meeting for October 28th, 2024

Agenda

Discussion

Increment and Decrement Operators in null conditional access

Champion issue: https://github.com/dotnet/csharplang/issues/6045
Spec: https://github.com/dotnet/csharplang/blob/28d016c4d9fc8cbbedfeb75c539e6bebbedc4292/proposals/null-conditional-assignment.md#incrementdecrement-operators

An issue came up during implementation of null conditional access, which allows null conditionals as the target of an assignment.

The question is whether to allow prefix/postfix increment/decrement operators, and the proposal is not to allow them. The alternative when increment or decrement is needed is to use compound assignments. Technically, the prefix operators would be difficult, and the outcome may not be what the programmer anticipated. Doing postfix, but not prefix operators may seem odd.

Conclusion

We decided to disallow these operators. If folks find scenarios where they need these operators, we might revisit this decision in the future.

yield in try / catch

Champion Issue: https://github.com/dotnet/csharplang/issues/8414
Spec: https://github.com/dotnet/csharplang/pull/8413

The proposal is to allow yield inside try/catch blocks in iterators, which is a longstanding user request. There are challenges, both technically and in matching programmer expectations. These particularly arise during dispose. The proposal is for only finally blocks, and not catch blocks to execute during dispose, even when an error is thrown in the finally block.

We went through the details of the behavior, and there are concerns that the programmer may expect catch to be executed during dispose. We also discussed the behavior of yield during dispose.

No conclusion was reached. We'll reconsider this in a future meeting after offline work and discussions.