Skip to content

for 2.0, make try/catch/else/finally scopeless? #48434

@StefanKarpinski

Description

@StefanKarpinski

There's been a number of complaints over the years about the fact that each clause of a try/catch/else/finally construct introduces new local scope. This means that if you assign something in the try clause it won't be visible afterwards. But moreover, it won't be visible in the catch, else or finally blocks. The lack of visibility in catch block is and after the whole try construct is somewhat justifiable since we don't want to by default leave undefined variables (although it is easy enough to do with something like if cond(); x = 1; end. Perhaps it would be simpler and easier if the whole try construct didn't introduce any local scopes? Similar to how if/else doesn't. Just a thought. Reference example issue: #46928.

Metadata

Metadata

Assignees

No one assigned

    Labels

    breakingThis change will break codedesignDesign of APIs or of the language itselfspeculativeWhether the change will be implemented is speculative

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions