> On Sep 23, 2017, at 1:24 AM, Georgios Moschovitis via swift-evolution 
> <[email protected]> wrote:
> 
> Copied from the corresponding Github issue, I would like to hear opinions 
> from the broader community on this:
> 
> I am wondering if the correct 'translation' to Swift of:
> 
> ```
> onNext()
> onError()
> ```
> 
> is really:
> 
> ```
> on(next:)
> on(error:)
> ```

I’ve played around with reactive streams, and one of the main issues with this 
naming convention is that it really confuses the compiler when you try to use 
trailing closure syntax:

aStream.on { nextOrError in

}

The compiler has a really hard time inferring what the type of nextOrError is 
without explicitly typing the parameter or not using trailing closure syntax.

Using .onNext { … } or .onError { … } bypasses this problem entirely.

Dave


> maybe something closer to Foundation's naming conventions would be:
> 
> ```
> didReceive(next:) or didReceive(value:)
> didReceive(error:)
> ```
> 
> -g.
> 
> _______________________________________________
> swift-evolution mailing list
> [email protected]
> https://lists.swift.org/mailman/listinfo/swift-evolution

_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to