Giter VIP home page Giter VIP logo

Comments (5)

jspahrsummers avatar jspahrsummers commented on April 19, 2024

@joshaber can speak to whether this was an intentional design choice, but I'd argue that it's the correct one. A subscribable of subscribables shouldn't send nil, because references to subscribables just generally shouldn't be nil. If you need to represent a nil or empty value, create a subscribable that returns it immediately.

from reactivecocoa.

Coneko avatar Coneko commented on April 19, 2024

I can see the logic behind that, and I would agree with it if it were an isolated matter, but it makes using subjects as properties a bit cumbersome.

Consider

[RACAble(self.object.subjectProperty) switch]

Even if whatever object is makes sure that subjectProperty is never set to nil, you'd still have to make sure the object property on self is never set to nil (and since object is not a subscribable itself, a nil value could make perfect sense), or use

[[[RACAble(self.object) where:^BOOL(id x) {
    return x != nil;
}] select: ^id(id x) {
    return [x subjectProperty];
}] switch]

instead.

The problem is compounded if you use subscribables that send objects that have subscribable properties.
A simple chain of select, switch and RACAble would have to be interspersed with where everywhere.
Even if it might not be strictly correct, I'd like to be able to switch nil subscribables because of this.

from reactivecocoa.

jspahrsummers avatar jspahrsummers commented on April 19, 2024

👍 Those are good points. I think -switch should be updated.

from reactivecocoa.

joshaber avatar joshaber commented on April 19, 2024

Makes sense to me 👍 PR opened.

from reactivecocoa.

Coneko avatar Coneko commented on April 19, 2024

Looks good, thanks for the fix and fast feedback.

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.