{"action":"created","issue":{"url":"https://api.github.com/repos/ReactiveX/RxKotlin/issues/17","labels_url":"https://api.github.com/repos/ReactiveX/RxKotlin/issues/17/labels{/name}","comments_url":"https://api.github.com/repos/ReactiveX/RxKotlin/issues/17/comments","events_url":"https://api.github.com/repos/ReactiveX/RxKotlin/issues/17/events","html_url":"https://github.com/ReactiveX/RxKotlin/pull/17","id":64262647,"number":17,"title":"Proposing Observable.subscribeWith { ... }","user":{"login":"SalomonBrys","id":249857,"avatar_url":"https://avatars.githubusercontent.com/u/249857?v=3","gravatar_id":"","url":"https://api.github.com/users/SalomonBrys","html_url":"https://github.com/SalomonBrys","followers_url":"https://api.github.com/users/SalomonBrys/followers","following_url":"https://api.github.com/users/SalomonBrys/following{/other_user}","gists_url":"https://api.github.com/users/SalomonBrys/gists{/gist_id}","starred_url":"https://api.github.com/users/SalomonBrys/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SalomonBrys/subscriptions","organizations_url":"https://api.github.com/users/SalomonBrys/orgs","repos_url":"https://api.github.com/users/SalomonBrys/repos","events_url":"https://api.github.com/users/SalomonBrys/events{/privacy}","received_events_url":"https://api.github.com/users/SalomonBrys/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-03-25T12:58:40Z","updated_at":"2015-03-27T09:40:45Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/ReactiveX/RxKotlin/pulls/17","html_url":"https://github.com/ReactiveX/RxKotlin/pull/17","diff_url":"https://github.com/ReactiveX/RxKotlin/pull/17.diff","patch_url":"https://github.com/ReactiveX/RxKotlin/pull/17.patch"},"body":"I find the current subscriber syntax cumbersome. Here's an example:\r\n\r\n```kotlin\r\nmyObservable.subscribe(subscriber<String>()\r\n    .onNext { println(it) }\r\n    .onError { it.printStackTrace() }\r\n)\r\n```\r\n\r\nThe problem I have is with `subscriber<String>()`. Because it creates a subscriber that is later modified with `.onNext` and `.onError`, the Kotlin compiler cannot infer it's type.  \r\nFor `subscriber<String>`, this is not such an issue, but for `subscriber<Map<String, User.Status>>` this can quickly become cumbersome.\r\n\r\nBeside, we could better use Kotlin's amazing type inference system and use a more \"Kotlin-esque\" way.\r\n\r\nThis PR introduces a new way of subscribing to an observable with this proposed API:\r\n\r\n```kotlin\r\nmyObservable.subscribeWith {\r\n    onNext { println(it) }\r\n    onError { it.printStackTrace() }\r\n}\r\n```\r\n\r\nThe API is using Kotlin's [type-safe builder pattern](http://kotlinlang.org/docs/reference/type-safe-builders.html).\r\n\r\nLet me know what you think ;)"},"comment":{"url":"https://api.github.com/repos/ReactiveX/RxKotlin/issues/comments/86881631","html_url":"https://github.com/ReactiveX/RxKotlin/pull/17#issuecomment-86881631","issue_url":"https://api.github.com/repos/ReactiveX/RxKotlin/issues/17","id":86881631,"user":{"login":"SalomonBrys","id":249857,"avatar_url":"https://avatars.githubusercontent.com/u/249857?v=3","gravatar_id":"","url":"https://api.github.com/users/SalomonBrys","html_url":"https://github.com/SalomonBrys","followers_url":"https://api.github.com/users/SalomonBrys/followers","following_url":"https://api.github.com/users/SalomonBrys/following{/other_user}","gists_url":"https://api.github.com/users/SalomonBrys/gists{/gist_id}","starred_url":"https://api.github.com/users/SalomonBrys/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SalomonBrys/subscriptions","organizations_url":"https://api.github.com/users/SalomonBrys/orgs","repos_url":"https://api.github.com/users/SalomonBrys/repos","events_url":"https://api.github.com/users/SalomonBrys/events{/privacy}","received_events_url":"https://api.github.com/users/SalomonBrys/received_events","type":"User","site_admin":false},"created_at":"2015-03-27T09:40:45Z","updated_at":"2015-03-27T09:40:45Z","body":"Travis has failed because \"The command \"eval git clone --depth=50 git://github.com/ReactiveX/RxKotlin.git ReactiveX/RxKotlin\" failed 3 times.\" but this PR does pass all unit tests"}}