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

Swift 2: `start` with trailing closure does not default to `next` #2294

Closed
Adlai-Holler opened this Issue Aug 27, 2015 · 3 comments

Comments

Projects
None yet
4 participants
@Adlai-Holler
Contributor

Adlai-Holler commented Aug 27, 2015

This may be intentional, but on the Swift 2 branch if I call myProducer.start { NSLog("\($0)") } I get events, rather than next values.

@neilpa

This comment has been minimized.

Member

neilpa commented Aug 27, 2015

I'm going to blame the compiler on this one. There's not enough context to know that you want the next variant here so it picks the single-arg overload.

Personally, I was never a fan of the change that made next be the trailing closure for this exact reason. I even broke it in one of the earlier betas by reordering the params but later reverted it.

@swizzlr

This comment has been minimized.

swizzlr commented Aug 30, 2015

I've encountered this too, but you can still get the trailing closure syntax by explicitly specifying the type of the parameter, or by using it in a type specific context (e.g. if next is a String, assigning it to a property of type String, most of the time the compiler will infer the type and overload correctly)

@ikesyo ikesyo added the duplicate label Apr 23, 2016

@ikesyo

This comment has been minimized.

Member

ikesyo commented Apr 23, 2016

Closing as a duplicate of #2311 (resolved by #2318).

@ikesyo ikesyo closed this Apr 23, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment