-
Notifications
You must be signed in to change notification settings - Fork 362
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
Support non-local break and continue inside inline lambdas #326
Comments
FYI the proposal link is broken, maybe it should be updated to point to the KEEP in |
I had missed this KEEP proposal. Sorry to bring an opinion this late. I guess there is no turning back from this at this point, but I just wanted to mention for the record that this feature encourages nested constructs. Having no Also, the Of course this is all a matter of code style, but if the language can steer devs towards a better style, I think it should. Now, I cannot make the same argument for |
joffrey-bion Thanks. I've fixed the link.
Not really. Most for the cases where I personally run into "WTF, I cannot use break here" were really short functions that would not benefit from splitting them into even more functions in any meaningful way. |
Thanks! Do you have an example of such function? It might actually change my mind on this |
I don't have an actual piece of code handy, but I think I know the usual pattern when it bites me personally. Often that's a typical use of
Now you notice that you have
|
My point was against The use of The main argument for this proposal is consistency with allowing non-local returns, so I can't really argue against that. And as I said it would be weird to allow The problem with made-up examples is that we can find solutions that maybe in real life were not available. For instance, the fact that I pass 4 arguments that are all properties of for (user in users) {
if (user.address == null) continue
sendNotificationTo(user)
} And if an extra list is not a problem, it would probably look like this: users.filter { it.address != null }.forEach { user -> sendNotificationTo(user) } |
joffrey-bion The real life is complicated. Sometimes you can refactor, sometimes you cannot. It depends. Both
|
This issue is for discussion of the proposal to support non-local
break
andcontinue
inside inline lambdas in Kotlin.Proposal PR #327.
The text was updated successfully, but these errors were encountered: