{"action":"created","issue":{"url":"https://api.github.com/repos/ponylang/ponyc/issues/539","repository_url":"https://api.github.com/repos/ponylang/ponyc","labels_url":"https://api.github.com/repos/ponylang/ponyc/issues/539/labels{/name}","comments_url":"https://api.github.com/repos/ponylang/ponyc/issues/539/comments","events_url":"https://api.github.com/repos/ponylang/ponyc/issues/539/events","html_url":"https://github.com/ponylang/ponyc/issues/539","id":135035171,"number":539,"title":"Can't create instance of private type from constructor of private type.","user":{"login":"jemc","id":4623870,"avatar_url":"https://avatars.githubusercontent.com/u/4623870?v=3","gravatar_id":"","url":"https://api.github.com/users/jemc","html_url":"https://github.com/jemc","followers_url":"https://api.github.com/users/jemc/followers","following_url":"https://api.github.com/users/jemc/following{/other_user}","gists_url":"https://api.github.com/users/jemc/gists{/gist_id}","starred_url":"https://api.github.com/users/jemc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jemc/subscriptions","organizations_url":"https://api.github.com/users/jemc/orgs","repos_url":"https://api.github.com/users/jemc/repos","events_url":"https://api.github.com/users/jemc/events{/privacy}","received_events_url":"https://api.github.com/users/jemc/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-02-20T05:19:21Z","updated_at":"2016-02-20T23:54:38Z","closed_at":null,"body":"I think this should be possible, but I could be wrong:\r\n\r\n```pony\r\nactor Main\r\n  new create(env: Env) =>\r\n    _A\r\n\r\nclass val _A\r\n  var b: _B\r\n  new iso create(b': _B = recover _B end) =>\r\n    b = b'\r\n\r\nclass val _B\r\n```\r\n```\r\nError:\r\n/home/jemc/1/code/gitx/ponyc/test/jemc/test.pony:8:39: can't lookup fields or methods on private types from other packages\r\n  new iso create(b': _B val = recover _B end) =>\r\n                                      ^\r\n\r\n```"},"comment":{"url":"https://api.github.com/repos/ponylang/ponyc/issues/comments/186705321","html_url":"https://github.com/ponylang/ponyc/issues/539#issuecomment-186705321","issue_url":"https://api.github.com/repos/ponylang/ponyc/issues/539","id":186705321,"user":{"login":"jemc","id":4623870,"avatar_url":"https://avatars.githubusercontent.com/u/4623870?v=3","gravatar_id":"","url":"https://api.github.com/users/jemc","html_url":"https://github.com/jemc","followers_url":"https://api.github.com/users/jemc/followers","following_url":"https://api.github.com/users/jemc/following{/other_user}","gists_url":"https://api.github.com/users/jemc/gists{/gist_id}","starred_url":"https://api.github.com/users/jemc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jemc/subscriptions","organizations_url":"https://api.github.com/users/jemc/orgs","repos_url":"https://api.github.com/users/jemc/repos","events_url":"https://api.github.com/users/jemc/events{/privacy}","received_events_url":"https://api.github.com/users/jemc/received_events","type":"User","site_admin":false},"created_at":"2016-02-20T23:54:38Z","updated_at":"2016-02-20T23:54:38Z","body":"> The issue is that default arguments are evaluated in the context of the **call site**.\r\n\r\nYeah, I figured this is what was going on, but it still seems more like a bug than a feature to me.\r\n\r\nWhen I think of the purpose of public vs private types, I think about it in terms of whether I can mention the type from other packages or not, and whether the name \"pollutes\" the package's namespace.  Since in this case I am not mentioning the type from code in another package, I would expect it to be okay.\r\n\r\nSo, in deciding about whether I want to argue this further or not, my main question would be - is this a problem at the LLVM IR level?  That is, is this use case impossible because functions of private Pony types are represented in a way that is not externally linkable?  Or is this just a case of the Pony compiler trying to enforce a reasonable definition of what it means for a type to be private?"}}