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

Type Inference fails in Kotlin #44

Closed
dalewking opened this issue Sep 28, 2015 · 8 comments · Fixed by #46
Closed

Type Inference fails in Kotlin #44

dalewking opened this issue Sep 28, 2015 · 8 comments · Fixed by #46

Comments

@dalewking
Copy link

When attempting to use RxLifecycle from Kotlin in an Observable chain the compiler cannot infer types in some cases unless explicitly specified.

Consider if I have a variable tasks of type Observable<List>

If I try to use that in an observable chain:

tasks.compose(RxLifecycle.bindView(taskList)) // followed by other clauses

The compiler complains that it cannot infer the type unless I explicitly specify it as in:

tasks.compose(RxLifecycle.bindView<List<Task>>(taskList)) // followed by other clauses

I think the problem is that you are not explicitly bounding the generic type to match the compose method. You have the method returning

Transformer<T, T>

And I think that should really be:

Transformer<? super T, ? extends T>

to match the semantics of the Observable.compose method.

I tested by writing a wrapper method that uses the latter return type and it fixes the type inference.

@dlew
Copy link
Contributor

dlew commented Sep 28, 2015

I've not been using Kotlin myself, but if you submit a pull request I'll gladly take it.

@dalewking
Copy link
Author

Sorry, I do not do PR's on GitHub, but the change is just a global search and replace of "Transformer<T, T>" and replacing that with "Transformer<? super T, ? extends T>"

@dlew
Copy link
Contributor

dlew commented Sep 28, 2015

Your boycotting comes off as "I don't want to do the work myself."

@dalewking
Copy link
Author

My boycotting is the fact that GitHub should be just about technology and be politically neutral, but it instead decided to promote an offensive political agenda. Therefore I can no longer in good conscience support them with my code. Note I also boycotted Stack Overflow for the same reason no longer have an account there and filter SO results from my search queries.

I'd be happy to submit a patch file or host the change on GitLab, but most people are not happy with that.

@jdreesen
Copy link

Could you please provide a link to GitHub's/Stack Overflow's offensive political agenda? I'm not aware of that. Thx.

@dlew
Copy link
Contributor

dlew commented Sep 28, 2015

You're not boycotting GitHub if you're just getting other people to make changes for you. You're submitting changes by proxy.

@dlew
Copy link
Contributor

dlew commented Sep 28, 2015

...Not to mention the obvious, which is that the existence of this issue calls into question whether this is a boycott or a dodge for doing work.

@dalewking
Copy link
Author

I don't want to get into the specifics of their political agenda because unlike GitHub I am not trying to promote a political agenda here and don't want to see this devolve into a political debate. My point is that Github should have been politics free, but they crossed a line

To understand my position, just pick your own hot button political issue that you feel passionately about. Now imagine how you would feel if Github changed the logo at the top of every page, including YOUR OWN pages, to show support for the opposite opinion of your own. The particular issue itself is not as important as the fact that Github should be just about tech, not politics.

While I refuse to support Github itself directly with my own code, I am not boycotting the people like you that use GitHub and the projects they create. I maintain an identity primarily so that I can support them with issue reports to make their software better. If GitHub could accept PRs from other repos, like GitLab I would gladly do it. I am sorry, but I have to draw the line somewhere.

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

Successfully merging a pull request may close this issue.

3 participants