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

Combine RACTuple with RACSequence #133

Closed
jspahrsummers opened this issue Nov 25, 2012 · 7 comments
Closed

Combine RACTuple with RACSequence #133

jspahrsummers opened this issue Nov 25, 2012 · 7 comments

Comments

@jspahrsummers
Copy link
Member

If RACSequence supported indexing and had first, second, etc. convenience methods like RACTuple, we could effectively get rid of the latter and be left with much more flexible tuples.

@joshaber
Copy link
Member

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

@jspahrsummers
Copy link
Member Author

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?

@joshaber
Copy link
Member

Yep, that'd work.

@Coneko
Copy link
Member

Coneko commented Nov 26, 2012

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.

@joshaber
Copy link
Member

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.

@Coneko
Copy link
Member

Coneko commented Dec 1, 2012

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.

@joshaber
Copy link
Member

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

andersio pushed a commit that referenced this issue Sep 22, 2016
* Changed `rex_text` bindable property to be an optional string

Fixes #125, #129.

* Updated UILabel's text property test to include nullability
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

3 participants