Skip to content
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

Reevaluate iteration order for scopes that start or end at the same position #1597

Open
pokey opened this issue Jul 7, 2023 · 0 comments
Open
Labels
enhancement New feature or request

Comments

@pokey
Copy link
Member

pokey commented Jul 7, 2023

In the following Python code:

def aaa():
    bbb = 0
    ccc = 0

ddd = 0

When you say "two states backward" from ddd = 0, you get ccc = 0 past ddd = 0, but you probably expect to get the function def aaa() past ddd = 0. The reason for the current behavior is that both the function and ccc = 0 end at the same position, and we yield the smaller scope first. For this case, we would prefer to yield the larger scope first.

However, in the desired implementation for #1057, we'd have the following:

    aaa(bbb, ccc)
#!1 ^^^^^^^^
#!2     ^^^^
#!3          ^^^

So if you said "two small paints backward" from ccc, today's behavior would give you bbb, ccc, which is probably what you want, but yielding larger scope first would give you aaa(bbb, ccc, which is probably not what you want.

There's something non-obvious here. It almost feels like you want to take into account iteration scope. In the latter example, you're crossing an iteration scope boundary, whereas in the former you're not

Note also that in the following case:

    foo(bar baz)
#!1 ^^^^^^^     
#!2     ^^^     
#!3         ^^^ 
#!4         ^^^^
#!5 ************
#!6     ******* 

If you're on foo, I'd expect "every small paint" to give foo(bar and baz), rather than foo(bar and baz. So in this case, we want the bigger scope for that second scope. But on bar I'd expect to get bar and baz. Again seems to have something to do with iteration scope 🤔. Almost feels like scopes should be associated with an iteration scope, which is kind of a move toward our earlier attempts to handle iteration

@pokey pokey added enhancement New feature or request to discuss Plan to discuss at meet-up labels Jul 7, 2023
@pokey pokey removed the to discuss Plan to discuss at meet-up label Mar 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant