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

Add a proposal for supporting non-local break and continue inside inline lambdas #327

Merged
merged 1 commit into from
Nov 11, 2022

Conversation

strangepleasures
Copy link
Contributor

No description provided.

@strangepleasures
Copy link
Contributor Author

Co-authored with @nikitabobko

with `noinline` and `crossinline`.

Non-local `break` and `continue` could be emulated using non-local return statements.
For example, the following code snippets should be equivalent with respect to DFA:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the following code snippets should be equivalent with respect to DFA

Same here. KEEP document must not contain such phrases. Someone should check that the DFA is equivalent for both cases and write his/her investigation details into the document

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we don't need this section at all. It relies on the semantic of run which seems to be less fundamental than the feature proposed (and this is not the only way to emulate non-local break/continue).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@strangepleasures sorry, I don't understand what you mean. I don't understand why this section relies on the semantic of run. run is just used because it's the most canonical way to invoke a lambda.

My point is different: I want that we really don't forget to check that the implementation is identical. And once we check it, we should mention it in the KEEP document. So the phrase "the following code snippets should be equivalent with respect to DFA" will turn into "in the current implementation the following code snippets is equivalent with respect to DFA"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nikitabobko but WHY do we need to check that in the first place? To me, this equivalence is just a fun fact, not a requirement. We could have also provided a semantically equivalent program written in different language, but what for?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but WHY do we need to check that in the first place?

We need to check it to try to find potential bugs we have in the current implementation. It's just one more check. What is the point of "it should work like that" phrase in a KEEP document if, in reality, it doesn't work "like that"? Let's please really make sure that it "works like that"

"it works like that" phrase (without "should"), gives one more invariant about the language.

Copy link
Contributor

@elizarov elizarov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

General comments:

  1. Please, run the whole text though Grazie. There are tons of obvious grammatical errors that should have been automatically detected.
  2. Mass-replace "loop-like" (in quotes) with loop-like without quotes for style issues.

proposals/break-continue-in-inline-lambdas.md Outdated Show resolved Hide resolved
proposals/break-continue-in-inline-lambdas.md Outdated Show resolved Hide resolved
proposals/break-continue-in-inline-lambdas.md Outdated Show resolved Hide resolved
proposals/break-continue-in-inline-lambdas.md Outdated Show resolved Hide resolved
proposals/break-continue-in-inline-lambdas.md Outdated Show resolved Hide resolved
proposals/break-continue-in-inline-lambdas.md Outdated Show resolved Hide resolved
proposals/break-continue-in-inline-lambdas.md Outdated Show resolved Hide resolved
proposals/break-continue-in-inline-lambdas.md Outdated Show resolved Hide resolved
proposals/break-continue-in-inline-lambdas.md Outdated Show resolved Hide resolved
proposals/break-continue-in-inline-lambdas.md Outdated Show resolved Hide resolved
@strangepleasures strangepleasures merged commit 91b8905 into master Nov 11, 2022
@strangepleasures strangepleasures deleted the break-continue-in-inline-lambdas branch November 11, 2022 15:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants