Git Product home page Git Product logo

Comments (10)

joshaber avatar joshaber commented on April 20, 2024

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."

from reactivecocoa.

jspahrsummers avatar jspahrsummers commented on April 20, 2024

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.

from reactivecocoa.

joshaber avatar joshaber commented on April 20, 2024

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.

from reactivecocoa.

jspahrsummers avatar jspahrsummers commented on April 20, 2024

What about RACTupleNil is superior to NSNull, then?

from reactivecocoa.

joshaber avatar joshaber commented on April 20, 2024

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

from reactivecocoa.

jspahrsummers avatar jspahrsummers commented on April 20, 2024

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

from reactivecocoa.

joshaber avatar joshaber commented on April 20, 2024

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

from reactivecocoa.

jspahrsummers avatar jspahrsummers commented on April 20, 2024

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.

from reactivecocoa.

joshaber avatar joshaber commented on April 20, 2024

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.

from reactivecocoa.

jspahrsummers avatar jspahrsummers commented on April 20, 2024

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

from reactivecocoa.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.