{"action":"created","issue":{"url":"https://api.github.com/repos/lihaoyi/scala.rx/issues/67","repository_url":"https://api.github.com/repos/lihaoyi/scala.rx","labels_url":"https://api.github.com/repos/lihaoyi/scala.rx/issues/67/labels{/name}","comments_url":"https://api.github.com/repos/lihaoyi/scala.rx/issues/67/comments","events_url":"https://api.github.com/repos/lihaoyi/scala.rx/issues/67/events","html_url":"https://github.com/lihaoyi/scala.rx/issues/67","id":157753181,"number":67,"title":"How to handle `Ctx.Owner` in classes","user":{"login":"Semptic","id":2183800,"avatar_url":"https://avatars.githubusercontent.com/u/2183800?v=3","gravatar_id":"","url":"https://api.github.com/users/Semptic","html_url":"https://github.com/Semptic","followers_url":"https://api.github.com/users/Semptic/followers","following_url":"https://api.github.com/users/Semptic/following{/other_user}","gists_url":"https://api.github.com/users/Semptic/gists{/gist_id}","starred_url":"https://api.github.com/users/Semptic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Semptic/subscriptions","organizations_url":"https://api.github.com/users/Semptic/orgs","repos_url":"https://api.github.com/users/Semptic/repos","events_url":"https://api.github.com/users/Semptic/events{/privacy}","received_events_url":"https://api.github.com/users/Semptic/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-05-31T19:41:02Z","updated_at":"2016-06-01T13:17:53Z","closed_at":null,"body":"I try to avoid adding `(implicit ctx: Ctx.Owner)` to each class with following approach:\r\n```\r\nclass Test {\r\n    implicit val ctx: Ctx.Owner = Ctx.Owner.safe()\r\n\r\n    var count = 0\r\n    val a = Var(1); val b = Var(2)\r\n    def mkRx(i: Int)(implicit ctx: Ctx.Owner) = Rx { count += 1; i + b() }\r\n    val c = Rx {\r\n      val newRx = mkRx(a())\r\n      newRx()\r\n    }\r\n    println(c.now, count)\r\n    a() = 4\r\n    println(c.now, count)\r\n    b() = 3\r\n    println(c.now, count) //(7,5) -- 5??\r\n\r\n    (0 to 100).foreach { i => a() = i }\r\n    println(c.now, count)\r\n    b() = 4\r\n    println(c.now, count) //(104,211) -- 211!!!\r\n  }\r\n```\r\n\r\nThis seams to work but I don't know if this is really correct or if there is a better way to do this."},"comment":{"url":"https://api.github.com/repos/lihaoyi/scala.rx/issues/comments/222989032","html_url":"https://github.com/lihaoyi/scala.rx/issues/67#issuecomment-222989032","issue_url":"https://api.github.com/repos/lihaoyi/scala.rx/issues/67","id":222989032,"user":{"login":"Voltir","id":889215,"avatar_url":"https://avatars.githubusercontent.com/u/889215?v=3","gravatar_id":"","url":"https://api.github.com/users/Voltir","html_url":"https://github.com/Voltir","followers_url":"https://api.github.com/users/Voltir/followers","following_url":"https://api.github.com/users/Voltir/following{/other_user}","gists_url":"https://api.github.com/users/Voltir/gists{/gist_id}","starred_url":"https://api.github.com/users/Voltir/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Voltir/subscriptions","organizations_url":"https://api.github.com/users/Voltir/orgs","repos_url":"https://api.github.com/users/Voltir/repos","events_url":"https://api.github.com/users/Voltir/events{/privacy}","received_events_url":"https://api.github.com/users/Voltir/received_events","type":"User","site_admin":false},"created_at":"2016-06-01T13:17:53Z","updated_at":"2016-06-01T13:17:53Z","body":"I think I understand and I might have an idea - basically you want a managed context that can be freed all at once. I can poke around for a bit and see what I come up with."}}
{"actor":{"display_login":"Voltir"}}