Skip to content

Conversation

@morganchen12
Copy link
Contributor

Fixes #99.

@asciimike
Copy link
Contributor

Mostly since I'm curious...

What's the difference between:

- fooWithBar:(nullable Bar *)bar;

And:

- fooWithBar:(Bar *_Nullable)bar;

Looks like nothing: http://stackoverflow.com/questions/32452889/difference-between-nullable-nullable-and-nullable-in-objective-c

Also, looks like the Google Objective-C style guide is missing guidance on nullability.

I prefer the first (and would like we use them everywhere we're allowed to, aka everywhere the compiler doesn't throw a fit [typedefs and blocks have special rules]).

@morganchen12
Copy link
Contributor Author

They're the same. There's also a third:

- (void)fooWithBar:(Bar *__nullable)bar;

The postfix _Nullable can be more useful(?) when referring to references of references, like:

- (void)fooWithBar:(Bar *)bar error:(NSError *_Nullable *_Nonnull)error;

but it's such a rare case that it probably doesn't matter. We should just pick one and commit to it (and update the Google style guide eventually). The prefix version definitely looks nicer.

@asciimike
Copy link
Contributor

Cool, thanks for the clarification :)

@asciimike asciimike merged commit fda0519 into firebase:master Aug 3, 2016
@morganchen12 morganchen12 deleted the nullability-fix branch October 5, 2016 23:03
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.

2 participants