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

Update documentation #27

Closed
alexandru opened this issue Oct 7, 2014 · 4 comments
Closed

Update documentation #27

alexandru opened this issue Oct 7, 2014 · 4 comments
Assignees
Milestone

Comments

@alexandru
Copy link
Member

Monifu needs good documentation and the current documentation is expired. The documentation needs to be updated and touch on the following subjects:

  • the contract of Observable and Observer
  • the API of Observable, Observer and Schedule (operators, builders)
  • usage of provided utilities that are orthogonal to Rx
  • tutorials, using introtorx.com as inspiration

This is an epic task that needs to be ready for 1.0.
Prior tickets on this issue:

@alexandru alexandru self-assigned this Oct 7, 2014
@l15k4
Copy link

l15k4 commented Jan 15, 2015

Hi, would you please share a little of your experience in regards to JS analogy to JVM Garbage Collection? For example is there a difference between :

class OuterFoo {
    Observable.interval(500.millis).foreach { tick =>
      if (tick % 2 == 0)
        println("foo")
      else
        println("bar")
    }
}

and :

class OuterFoo {
    Observable.interval(500.millis).foreach { tick =>
      if (tick % 2 == 0)
        myElementRef.style.visibility = "visible"
      else
        myElementRef.style.visibility = "hidden"
    }
}

I guess the first will be running until the OuterFoo is freed and the latter would additionally depend on the myElementRef freeing in foreach function, right? I really hope OuterFoo is GCed when nothing holds a reference to it.

I try to read up a little bit about JS GC, but I'm not feeling any wiser now. There used to be a note in Wiki about this, but I can't find it anywhere. Imho it got lost.

@alexandru
Copy link
Member Author

@l15k4 initiating an interval tick by means of Observable.interval is triggering the Scheduler to do that, which happens by means of setTimeout. This means that the observable in question, along with the observer that subscribed to it, will NOT get garbage collected until the observable in question is complete. And in your example it's an infinite stream, so it stays active until you somehow cancel it. Note that in Javascript, even if you wanted, you couldn't implement something smarter than that. This is because in Javascript there is no support for weak references.

So btw, both examples behave in the same way, there's absolutely no difference. Both will be running until the end of time, starting with a new OuterFoo of course. And OuterFoo does not get garbage collected btw.

And personally I prefer that, because I wouldn't want the garbage collector to somehow stop the streaming of values that I care about. But please do describe a use-case.

@l15k4
Copy link

l15k4 commented Jan 15, 2015

@alexandru thank you for explanation, I personally prefer that behavior too, I just wasn't sure it really behaves this way.

@alexandru
Copy link
Member Author

We already started the documentation project as part of - https://monix.io

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

2 participants