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

Refactor code for Swift 1.2. #26

Merged
merged 39 commits into from Apr 23, 2015
Merged

Refactor code for Swift 1.2. #26

merged 39 commits into from Apr 23, 2015

Conversation

inamiy
Copy link
Member

@inamiy inamiy commented Apr 5, 2015

This pull request is a BREAKING CHANGE where not only fixing for Swift 1.2 but also refactoring whole codes as follows:

  • 1. Rename Signal<T> to Stream<T>
  • 2. Stream-operation functions
    • 1. Move functions outside of Stream<T> class for better type-constraints.
    • 2. Rename e.g. merge, mergeAll, mergeInner & always use **All (stream-array) and **Inner (nested-stream) naming conventions
    • 3. Add more useful operations
      • distinct()
      • distinctUntilChanged()
      • reduce()
      • interval()
      • switchLatestInner()
      • prestart() (a.k.a Rx.replay)
      • catch()
      • retry()
      • repeat()
  • 3. Add stream pipe operator |> and stream-producer pipe operator |>> in replace of dot-method-chaining syntax.
  • 4. Add terminal reacting operator ~>! () to collect synchronously-emitted values (useful just like Java 8 Stream API)
  • 5. Update README.md

@inamiy inamiy added this to the 0.10.0 milestone Apr 5, 2015
@DarthMike
Copy link

@inamiy First of all, thanks for the lib!

I've got an observation, why do you want to rename Signal to Stream ? Signal already implies stream of values, doesn't it?

@inamiy
Copy link
Member Author

inamiy commented Apr 6, 2015

@DarthMike Hi, thanks for question 😄

Though Signal is fairly common term in some languages including ReactiveCocoa in ObjC/Swift, I find Stream is more suitable due to the following reasons:

  • ReactKit.Stream is now getting very similar to Java 8 Stream API, matz/streem, and even existing NSInputStream.
  • Naming upper & lower streams as upstream & downstream improves (core) code readability ("upsignal" & "downsignal" were not torelable to me 😤)
  • Signal (may) confuses with POSIX signal.

And above all, I like the phrase "Everything is a stream" in The introduction to Reactive Programming you've been missing.

@DarthMike
Copy link

@inamiy Yes makes sense 👍 Naming is the second hardest problem in programming 😄

@inamiy
Copy link
Member Author

inamiy commented Apr 6, 2015

@DarthMike Good to hear you are on this change 😉

@inamiy inamiy changed the title [WIP] Refactor code for Swift 1.2. Refactor code for Swift 1.2. Apr 23, 2015
@inamiy
Copy link
Member Author

inamiy commented Apr 23, 2015

Ready to :shipit:

inamiy added a commit that referenced this pull request Apr 23, 2015
Refactor code for Swift 1.2.
@inamiy inamiy merged commit 365be13 into swift/1.2 Apr 23, 2015
@inamiy inamiy mentioned this pull request Apr 23, 2015
@inamiy inamiy deleted the refactor branch April 23, 2015 11:22
@DarthMike
Copy link

I've seen new release. Will try later today or tomorrow 🚀 Thanks!

@inamiy
Copy link
Member Author

inamiy commented Apr 23, 2015

Thanks too! Any feedback is welcome 😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants