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

Add backward compatible Obj-C Generic support for Tasks. #136

Merged
merged 1 commit into from
Sep 8, 2015

Conversation

nlutsenko
Copy link
Member

This support latest syntax in Xcode 7, and also is backward compatible via macro.
cc @grantland, @hallucinogen, @richardjrossiii

@grantland
Copy link
Member

LGTM

@grantland
Copy link
Member

Do we not have to update the implementation files?

@nlutsenko
Copy link
Member Author

Aha, I am glad you asked - the answer is actually no, ObjC generics are only for interfaces/APIs and enforce replacement with id when used inside implementation (it resolves into a compiler error if used inside the implementation)

@grantland
Copy link
Member

lol nice

@nlutsenko
Copy link
Member Author

I've just updated the PR, so we have covariant support on this.
This is to enable something like this:

BFTask<NSString *> *stringTask = [BFTask taskWithResult:[NSString string]];
BFTask<NSMutableString *> *mutableStringTask = [BFTask taskWithResult:[NSMutableString string]];
stringTask = mutableStringTask; // This is valid, since NSMutableString is a subclass of NSString

@richardjrossiii
Copy link
Member

<3 covariants.

On Sep 2, 2015, at 8:07 PM, Nikita Lutsenko [email protected] wrote:

I've just updated the PR, so we have covariant support on this.
This is to enable something like this:

BFTask<NSString *> *stringTask = [BFTask taskWithResult:[NSString string]];
BFTask<NSMutableString *> *mutableStringTask = [BFTask taskWithResult:[NSMutableString string]];
stringTask = mutableStringTask; // This is valid, since NSMutableString is a subclass of NSString

Reply to this email directly or view it on GitHub.

@grantland
Copy link
Member

even better!

@nlutsenko nlutsenko force-pushed the nlutsenko.generics branch 2 times, most recently from e4d03d3 to 542bc46 Compare September 8, 2015 18:14
@nlutsenko nlutsenko added this to the 1.2.2 milestone Sep 8, 2015
nlutsenko added a commit that referenced this pull request Sep 8, 2015
Add backward compatible Obj-C Generic support for Tasks.
@nlutsenko nlutsenko merged commit 2e6893f into master Sep 8, 2015
@nlutsenko nlutsenko deleted the nlutsenko.generics branch September 8, 2015 19:52
@facebook-github-bot
Copy link
Contributor

@nlutsenko updated the pull request.

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

Successfully merging this pull request may close these issues.

4 participants