{"action":"created","issue":{"url":"https://api.github.com/repos/japgolly/scalajs-react/issues/116","labels_url":"https://api.github.com/repos/japgolly/scalajs-react/issues/116/labels{/name}","comments_url":"https://api.github.com/repos/japgolly/scalajs-react/issues/116/comments","events_url":"https://api.github.com/repos/japgolly/scalajs-react/issues/116/events","html_url":"https://github.com/japgolly/scalajs-react/issues/116","id":73126725,"number":116,"title":"Issues with overloaded methods (render)","user":{"login":"elacin","id":247937,"avatar_url":"https://avatars.githubusercontent.com/u/247937?v=3","gravatar_id":"","url":"https://api.github.com/users/elacin","html_url":"https://github.com/elacin","followers_url":"https://api.github.com/users/elacin/followers","following_url":"https://api.github.com/users/elacin/following{/other_user}","gists_url":"https://api.github.com/users/elacin/gists{/gist_id}","starred_url":"https://api.github.com/users/elacin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elacin/subscriptions","organizations_url":"https://api.github.com/users/elacin/orgs","repos_url":"https://api.github.com/users/elacin/repos","events_url":"https://api.github.com/users/elacin/events{/privacy}","received_events_url":"https://api.github.com/users/elacin/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-05-04T20:59:36Z","updated_at":"2015-05-04T22:43:35Z","closed_at":null,"body":"I'm having a lot of fun hacking on scalajs-react, and wanted to raise one issue that keeps bothering me.\r\nIn most examples the following style is used:\r\n\r\n```scala\r\n    ReactComponentB[List[String]](\"app\")\r\n      .initialState(State(0))\r\n      .backend(new Backend(_))\r\n      .render((P, S, B) ⇒ {\r\n        val a = S.index\r\n        div(s\"State: $a\")\r\n      }\r\n      ).build\r\n\r\n```\r\n\r\nPersonally, i always have the urge to rewrite that into the following to get better pattern matching capabilities, and to avoid double set of parentheses if there is more than one statement within the function\r\n```scala\r\n  ReactComponentB[List[String]](\"app\")\r\n    .initialState(State(0))\r\n    .backend(new Backend(_))\r\n    .render {\r\n      case (_, state, _) ⇒\r\n        val a = state.index\r\n        div(s\"State: $a\")\r\n    }.build\r\n\r\n```\r\n\r\nThis, however, doesn't work, because of the multiple overloads of `render()`, and scalac spits out \r\n```\r\nError:(56, 13) missing parameter type for expanded function\r\nThe argument types of an anonymous function must be fully known. (SLS 8.5)\r\nExpected type was: ?\r\n    .render {\r\n            ^\r\n```\r\n\r\nSo this is, as far as i can see, an unfortunate limitation of the compiler that makes the library a bit confusing to use. Would you consider a PR where I either change the method names or (I'm sure preferably) introduce new wrapper functions so it's easy to disambiguate?\r\n\r\nIf yes, any naming preference?\r\n- `render`, `renderWithChildren`, `renderComponentScope` \r\n- or shorter versions like for example `render`, `renderC`, `renderCS`\r\n"},"comment":{"url":"https://api.github.com/repos/japgolly/scalajs-react/issues/comments/98876218","html_url":"https://github.com/japgolly/scalajs-react/issues/116#issuecomment-98876218","issue_url":"https://api.github.com/repos/japgolly/scalajs-react/issues/116","id":98876218,"user":{"login":"elacin","id":247937,"avatar_url":"https://avatars.githubusercontent.com/u/247937?v=3","gravatar_id":"","url":"https://api.github.com/users/elacin","html_url":"https://github.com/elacin","followers_url":"https://api.github.com/users/elacin/followers","following_url":"https://api.github.com/users/elacin/following{/other_user}","gists_url":"https://api.github.com/users/elacin/gists{/gist_id}","starred_url":"https://api.github.com/users/elacin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elacin/subscriptions","organizations_url":"https://api.github.com/users/elacin/orgs","repos_url":"https://api.github.com/users/elacin/repos","events_url":"https://api.github.com/users/elacin/events{/privacy}","received_events_url":"https://api.github.com/users/elacin/received_events","type":"User","site_admin":false},"created_at":"2015-05-04T22:43:35Z","updated_at":"2015-05-04T22:43:35Z","body":"Sure. And just to be clear, its the general horribleness of overloaded methods (type inference, following/reading code, error messages) that irks me more than lack of pattern matching in particular, and this was a very visible place in the API, lets say :)\r\n"}}