{"action":"created","issue":{"url":"https://api.github.com/repos/parapluu/encore/issues/792","repository_url":"https://api.github.com/repos/parapluu/encore","labels_url":"https://api.github.com/repos/parapluu/encore/issues/792/labels{/name}","comments_url":"https://api.github.com/repos/parapluu/encore/issues/792/comments","events_url":"https://api.github.com/repos/parapluu/encore/issues/792/events","html_url":"https://github.com/parapluu/encore/issues/792","id":225909790,"number":792,"title":"Restrictive forward's type","user":{"login":"PhucVH888","id":11764206,"avatar_url":"https://avatars0.githubusercontent.com/u/11764206?v=3","gravatar_id":"","url":"https://api.github.com/users/PhucVH888","html_url":"https://github.com/PhucVH888","followers_url":"https://api.github.com/users/PhucVH888/followers","following_url":"https://api.github.com/users/PhucVH888/following{/other_user}","gists_url":"https://api.github.com/users/PhucVH888/gists{/gist_id}","starred_url":"https://api.github.com/users/PhucVH888/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PhucVH888/subscriptions","organizations_url":"https://api.github.com/users/PhucVH888/orgs","repos_url":"https://api.github.com/users/PhucVH888/repos","events_url":"https://api.github.com/users/PhucVH888/events{/privacy}","received_events_url":"https://api.github.com/users/PhucVH888/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-05-03T08:04:53Z","updated_at":"2017-05-11T09:20:27Z","closed_at":null,"body":"The `forward`'s type is too restrictive. When using nested `forward` in the following example, an extra variable `arg1` is necessary for passing the typecheck. A better way is to relax the `forward`'s type so that no extra variable is used to do the trick.\r\n```\r\nactive class Base\r\n  def base() : int\r\n    42\r\n  end\r\nend\r\n\r\nactive class Bar\r\n  def bar() : int\r\n    24\r\n  end\r\nend\r\n\r\nactive class Foo\r\n  def foo(b : bool) : int\r\n    val arg1 = (new Bar) ! bar()\r\n    val arg2 = (new Base) ! base()\r\n    forward(if b then\r\n              forward(arg1)\r\n              arg1 -- required to make typecheck\r\n            else\r\n              arg2\r\n            end)\r\n  end\r\nend\r\n\r\nactive class Main\r\n  def main() : unit\r\n    println(\"{}\", get((new Foo) ! foo(true)))\r\n    println(\"{}\", get((new Foo) ! foo(false)))\r\n  end\r\nend\r\n```"},"comment":{"url":"https://api.github.com/repos/parapluu/encore/issues/comments/300733262","html_url":"https://github.com/parapluu/encore/issues/792#issuecomment-300733262","issue_url":"https://api.github.com/repos/parapluu/encore/issues/792","id":300733262,"user":{"login":"supercooldave","id":4776551,"avatar_url":"https://avatars1.githubusercontent.com/u/4776551?v=3","gravatar_id":"","url":"https://api.github.com/users/supercooldave","html_url":"https://github.com/supercooldave","followers_url":"https://api.github.com/users/supercooldave/followers","following_url":"https://api.github.com/users/supercooldave/following{/other_user}","gists_url":"https://api.github.com/users/supercooldave/gists{/gist_id}","starred_url":"https://api.github.com/users/supercooldave/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/supercooldave/subscriptions","organizations_url":"https://api.github.com/users/supercooldave/orgs","repos_url":"https://api.github.com/users/supercooldave/repos","events_url":"https://api.github.com/users/supercooldave/events{/privacy}","received_events_url":"https://api.github.com/users/supercooldave/received_events","type":"User","site_admin":false},"created_at":"2017-05-11T09:20:27Z","updated_at":"2017-05-11T09:20:27Z","body":"It seems that `return` and `abort()` have the same problem."}}
{"actor":{"display_login":"supercooldave"}}