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

Inline Completable.andThen #111

Closed
eygraber opened this issue Apr 6, 2017 · 7 comments
Closed

Inline Completable.andThen #111

eygraber opened this issue Apr 6, 2017 · 7 comments

Comments

@eygraber
Copy link

eygraber commented Apr 6, 2017

Completable.andThen also gets in the way of having a nice DSL-like structure for my chains.

Something like this would help with that:

inline fun Completable.andThen(action: () -> Completable) = andThen(action())

@stepango
Copy link
Collaborator

stepango commented Apr 7, 2017

I'm afraid this extension should have a different name because it's ambiguous what method exactly are you trying to call.

Completable.andThen(CompletableSource)

Have same signature from Kotlin's perspective. Both have SAM parameter and both are transformed to andThen(() -> T)

Do you have a different name in mind?

@eygraber
Copy link
Author

eygraber commented Apr 7, 2017

I have them both in a project, and there's no ambiguity. Am I missing something?

@stepango
Copy link
Collaborator

Let me give you an example.

  1. Let's add your extension to a project
    inline fun Completable.andThen(action: () -> Completable) = andThen(action())
  2. Let's call Completable.complete().andThen { Completable.complete() } in some random file

@eygraber what method would be called?

@eygraber
Copy link
Author

@stepango I was using rxjava 1 🙈

@thomasnield
Copy link
Collaborator

We can put something towards the 1.x branch if you want

@eygraber
Copy link
Author

@thomasnield that might be helpful in general, but I've moved on to rxjava 2 already 😁

@thomasnield
Copy link
Collaborator

Fair enough

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

No branches or pull requests

3 participants