-
Notifications
You must be signed in to change notification settings - Fork 528
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inconsistent block scoping #22204
Comments
The difference first traces back to Perl_op_scope. Within that function, dumping
For the else block,
The presence or absence of |
The callers to Perl_op_scope are:
I have no understanding of the parser logic and don't know why |
Here's a simple example demonstrating this:
A developer reasoning about this Perl code might expect the output to be:
whereas it actually outputs this:
because the destructor isn't called at the expected time when the true branch of the if statement is followed. |
Description
Given an if/else branch, such as the example below, it seems like a reasonable expectation that both branches behave identically with regard to entering a new scope - or not doing so.
But they don't. The else branch is wrapped in an ENTER/LEAVE pair, but the if branch is not.
That's not always the behaviour. In the following example, both branches are wrapped in an ENTER/LEAVE pair:
The inconsistency seems undesirable because:
Steps to Reproduce
Expected behavior
Both branches have consistent scope behaviour.
Perl configuration
Standard blead, v5.36
The text was updated successfully, but these errors were encountered: