{"action":"created","issue":{"url":"https://api.github.com/repos/scalapuzzlers/scalapuzzlers.github.com/issues/121","labels_url":"https://api.github.com/repos/scalapuzzlers/scalapuzzlers.github.com/issues/121/labels{/name}","comments_url":"https://api.github.com/repos/scalapuzzlers/scalapuzzlers.github.com/issues/121/comments","events_url":"https://api.github.com/repos/scalapuzzlers/scalapuzzlers.github.com/issues/121/events","html_url":"https://github.com/scalapuzzlers/scalapuzzlers.github.com/issues/121","id":70330565,"number":121,"title":"Convert me, convert me not","user":{"login":"som-snytt","id":369425,"avatar_url":"https://avatars.githubusercontent.com/u/369425?v=3","gravatar_id":"","url":"https://api.github.com/users/som-snytt","html_url":"https://github.com/som-snytt","followers_url":"https://api.github.com/users/som-snytt/followers","following_url":"https://api.github.com/users/som-snytt/following{/other_user}","gists_url":"https://api.github.com/users/som-snytt/gists{/gist_id}","starred_url":"https://api.github.com/users/som-snytt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/som-snytt/subscriptions","organizations_url":"https://api.github.com/users/som-snytt/orgs","repos_url":"https://api.github.com/users/som-snytt/repos","events_url":"https://api.github.com/users/som-snytt/events{/privacy}","received_events_url":"https://api.github.com/users/som-snytt/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-04-23T07:06:08Z","updated_at":"2015-04-26T00:18:02Z","closed_at":null,"body":"I answered this question, then I thought, Hm, that's a source of mild puzzlement.\r\n\r\nThe pleasant part is the symmetry of the two invocations.\r\n\r\nIt's also a twist on the endless discussions about when to have an empty param list or none.\r\n\r\n```\r\nclass Gate {\r\n  def unary_!(): Gate = this\r\n}\r\n\r\nclass Foo {\r\n  private def foo(f: () => Gate) = 1\r\n  val gate = new Gate\r\n\r\n  // Compiles, -Xprint:typer shows it becomes\r\n  //   Foo.this.foo({\r\n  //     (() => Foo.this.gate.unary_!())\r\n  //   })\r\n  foo(!gate)\r\n\r\n  // Does not compile, we get\r\n  //  error: type mismatch;\r\n  //  found   : Gate\r\n  //  required: () => Gate\r\n  //  foo(gate)\r\n  foo(gate)\r\n}\r\n```\r\n\r\nhttp://stackoverflow.com/q/29815264/1296806"},"comment":{"url":"https://api.github.com/repos/scalapuzzlers/scalapuzzlers.github.com/issues/comments/96298276","html_url":"https://github.com/scalapuzzlers/scalapuzzlers.github.com/issues/121#issuecomment-96298276","issue_url":"https://api.github.com/repos/scalapuzzlers/scalapuzzlers.github.com/issues/121","id":96298276,"user":{"login":"demobox","id":223702,"avatar_url":"https://avatars.githubusercontent.com/u/223702?v=3","gravatar_id":"","url":"https://api.github.com/users/demobox","html_url":"https://github.com/demobox","followers_url":"https://api.github.com/users/demobox/followers","following_url":"https://api.github.com/users/demobox/following{/other_user}","gists_url":"https://api.github.com/users/demobox/gists{/gist_id}","starred_url":"https://api.github.com/users/demobox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/demobox/subscriptions","organizations_url":"https://api.github.com/users/demobox/orgs","repos_url":"https://api.github.com/users/demobox/repos","events_url":"https://api.github.com/users/demobox/events{/privacy}","received_events_url":"https://api.github.com/users/demobox/received_events","type":"User","site_admin":false},"created_at":"2015-04-26T00:18:02Z","updated_at":"2015-04-26T00:18:02Z","body":"@som-snytt: Actually...I think the underlying reason for the last example is **not** covered by SI-7187, so is a \"legitimate\" puzzler: what seems to be happening there is that `-gate` is typed as `Gate` due to the first clause of [6.26.2](http://www.scala-lang.org/files/archive/nightly/pdfs/ScalaReference.pdf):\r\n\r\n\"Evaluation. A parameterless method m of type => T is always converted to type\r\nT by evaluating the expression to which m is bound\"\r\n\r\nOnly `+gate`, which is **not** a parameterless method, becomes a candidate for eta-expansion.\r\n\r\nThe question remains whether the proposed fix for SI-7187 - applying Empty Application before Eta Expansion, would cause `+gate` to _also_ fail to compile, or whether the compile would conclude that Empty Application does not produce the correct type, and then would try Eta Expansion.\r\n\r\nIn the latter case, `-gate` and `+gate` would continue to behave differently...and puzzlingly ;-)"}}