Giter VIP home page Giter VIP logo

Comments (7)

joshaber avatar joshaber commented on April 19, 2024

RACTuple's main use is holding nil in a collection.

from reactivecocoa.

jspahrsummers avatar jspahrsummers commented on April 19, 2024

Hmm, that is a problem, but I don't like how terrible tuples are to work with right now.

Maybe RACTuple could be a special RACSequence subclass which maps to and from RACTupleNil as appropriate, similarly to how it uses NSArray internally right now?

from reactivecocoa.

joshaber avatar joshaber commented on April 19, 2024

Yep, that'd work.

from reactivecocoa.

Coneko avatar Coneko commented on April 19, 2024

Depends on whether you want a tuple class at all really.

I find it a bit strange that +combineLatest: takes an NSArray as a parameter, but then returns a RACTuple.
The fact that in +combineLatest:reduce: the reduceBlock is given parameters separately instead of wrapped in a RACTuple seems to imply tuples are the expected way of handling the combined subscribables, but the fact that RACTuple is a collection object that can be iterated on doesn't really confirm that.

If RACTuple's aim is only to simplify handling nil in collections, which by itself is already a very handy thing, then a special sequence instead of a different class seems to be better. A method could be added to RACSequence (or to RACStream even) to convert any sequence to it's equivalent automatically-converting nil version.

If instead RACTuple is supposed to be a tuple, I think having a tuple sequence is very confusing.

from reactivecocoa.

joshaber avatar joshaber commented on April 19, 2024

I'm not sure the added conceptual weight of RACTuple is worth it. Tuples don't really give us anything sequences couldn't. The semantic difference is nice but pretty foreign in Cocoa and without any real payoff.

from reactivecocoa.

Coneko avatar Coneko commented on April 19, 2024

On second thought, from what I can see RACTuple is pretty much an internal class born from the necessity of having RACSignal distinguish between nil and +[NSNull null] since both are valid values.

I don't think it's going to be useful to combine it with RACSequence given it's purpose.

from reactivecocoa.

joshaber avatar joshaber commented on April 19, 2024

Now that RACTupleUnpack exists it has a more useful role as a true tuple.

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.