Skip to content

[Proposal]: Remove error "Cannot yield a value in the body of a try block with a catch clause" #8995

Open
@333fred

Description

@333fred

Remove error "Cannot yield a value in the body of a try block with a catch clause"

Summary

As recently noted by C# users, the existing restriction that you cannot yield a value in the body of a try block with a catch clause is one that interferes with reasonable code refactoring. The restriction does not make the compiler any easier. Rather it was added to align with the conceptual model that the caller's loop is logically "called" at the point of the yield. But that is not how people think of the construct, and the restriction has little value. We propose to remove it.

Design meetings

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions