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

Replace RACTupleNil with EXTNil #99

Closed
jspahrsummers opened this issue Nov 3, 2012 · 10 comments
Closed

Replace RACTupleNil with EXTNil #99

jspahrsummers opened this issue Nov 3, 2012 · 10 comments

Comments

@jspahrsummers
Copy link
Member

I know that RACTupleNil was deliberately chosen over EXTNil at one point, but I don't remember/understand the motivation for it.

EXTNil interoperates with code that expects nil or NSNull, so is more "backwards compatible" in a certain sense. This same property also makes it nicer for things like RACBlockTrampoline, because EXTNil == nil for most intents and purposes.

@joshaber
Copy link
Member

joshaber commented Nov 3, 2012

It's the "most intents and purposes" part that bothers me. It seems better in my mind to just use a sentinel and real nil than to say "it sends EXTNil which mostly behaves like nil but isn't."

@jspahrsummers
Copy link
Member Author

It's really just identity checks and other methods which reveal it to be an actual object and not truly nil, but there's nothing to prevent mapping it to a real nil, like is done with RACTupleNil.

It's mostly valuable in collections, so you can save and pull out values that actually behave as nil.

@joshaber
Copy link
Member

joshaber commented Nov 3, 2012

Right, since we're almost always just mapping it to true nil, I'm not sure what the advantage is.

My perspective is this. For consumers, nil will always be better. So as much as we possibly can, we never expose RACTupleNil. But the few times we do expose it, we should be honest about what it is. It's not nil. It can't be used as nil. It's a sentinel. EXTNil blurs that line without much benefit.

@jspahrsummers
Copy link
Member Author

What about RACTupleNil is superior to NSNull, then?

@joshaber
Copy link
Member

joshaber commented Nov 4, 2012

Nothing, except that it's not NSNull. The meaning of NSNulls isn't well-defined. The meaning of RACTupleNil is.

@jspahrsummers
Copy link
Member Author

I disagree. NSNull is used throughout Cocoa as "nil represented in a collection." In particular, that's how KVC/KVO treats it.

@joshaber
Copy link
Member

joshaber commented Nov 4, 2012

Perhaps, but users could mean NSNull to indicate something else as well. It might have a different meaning from nil in their use.

@jspahrsummers
Copy link
Member Author

That would be user error, IMO, specifically because NSNull already has special meaning for KVC. Like, if you use it to represent something in a property, for example, -setValuesForKeysWithDictionary: will never be able to set it.

@joshaber
Copy link
Member

joshaber commented Nov 4, 2012

That's one use of NSNull but AFAIK, there's nothing that says that's the only legitimate use.

RACTupleNil is to RAC as NSNull is to KVC.

@jspahrsummers
Copy link
Member Author

I don't really agree with that, but I think we're at an impasse, and it's not a big deal either way.

andersio pushed a commit that referenced this issue Sep 22, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants