-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Optional Iteration #878
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
Optional Iteration #878
Conversation
@jrose-apple, is it possible to schedule a review for this? |
I'm not on the core team, sorry. I'm not sure if they were waiting for anything else. |
I see, excuse me then. cc @jckarter |
proposals/optional-iteration.md
Outdated
|
||
for? element in array { ... } | ||
// Equivalent to | ||
for element in array! { ... } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would clarify what the syntactic construct is equivalent to in the general case:
if let array2 = array {
for element in array2 {
...
}
}
This summary suggests that the force-unwrap is part of the behavior of for?
, which might mislead someone reading this bit in isolation.
Once an implementation is ready, we can queue the proposal for review. |
Is it necessary for the implementation to be ready for merging (reviewed and approved)? I've got a working draft over here. |
This proposal is about allowing optional sequences in
for-in
loops.https://forums.swift.org/t/another-try-at-allowing-optional-iteration/14376/44
Implementation – swiftlang/swift#19207