{"action":"created","issue":{"url":"https://api.github.com/repos/chapel-lang/chapel/issues/2145","labels_url":"https://api.github.com/repos/chapel-lang/chapel/issues/2145/labels{/name}","comments_url":"https://api.github.com/repos/chapel-lang/chapel/issues/2145/comments","events_url":"https://api.github.com/repos/chapel-lang/chapel/issues/2145/events","html_url":"https://github.com/chapel-lang/chapel/pull/2145","id":93619442,"number":2145,"title":"Add public and private as part of module declarations","user":{"login":"lydia-duncan","id":2454710,"avatar_url":"https://avatars.githubusercontent.com/u/2454710?v=3","gravatar_id":"","url":"https://api.github.com/users/lydia-duncan","html_url":"https://github.com/lydia-duncan","followers_url":"https://api.github.com/users/lydia-duncan/followers","following_url":"https://api.github.com/users/lydia-duncan/following{/other_user}","gists_url":"https://api.github.com/users/lydia-duncan/gists{/gist_id}","starred_url":"https://api.github.com/users/lydia-duncan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lydia-duncan/subscriptions","organizations_url":"https://api.github.com/users/lydia-duncan/orgs","repos_url":"https://api.github.com/users/lydia-duncan/repos","events_url":"https://api.github.com/users/lydia-duncan/events{/privacy}","received_events_url":"https://api.github.com/users/lydia-duncan/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-07-07T20:20:53Z","updated_at":"2015-07-07T20:22:43Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/chapel-lang/chapel/pulls/2145","html_url":"https://github.com/chapel-lang/chapel/pull/2145","diff_url":"https://github.com/chapel-lang/chapel/pull/2145.diff","patch_url":"https://github.com/chapel-lang/chapel/pull/2145.patch"},"body":"This allows modules to be declared as publicly available or only available\r\nto their declared scope, and maintains the default behavior of modules\r\nbeing publicly available.  If a module A is private, A is only visible to its\r\nparent module (B) and can only be used by B.  If B uses A, then A's\r\nsymbols will be visible to any other submodule of B, but A's symbols\r\nwill not be visible to any outside module that uses B.  Put another way,\r\nuses of private modules are not transitive.\r\n\r\nI have provided tests to verify the above specifications.  I have also\r\nupdated the emacs and vim modes to include these new keywords and\r\nverified that the update modes work correctly.\r\n\r\nImplementation Details:\r\ncompiler/include/flags_list.h\r\n  I added a new flag, FLAG_PRIVATE to distinguish between private and public\r\n  symbols - if a symbol is public, it will not have FLAG_PRIVATE attached to\r\n  it.\r\n\r\ncompiler/include/build.h, compiler/parser/chapel.ypp, compiler/parser/parser.cpp,\r\ncompiler/AST/build.cpp\r\n  Allows the parser at build time to declare the module as either public or\r\n  private based on the presence or absence of those keywords.\r\n\r\ncompiler/include/symbol.h, compiler/passes/scopeResolve.cpp\r\n  Adds a method \"isVisible\" to ModuleSymbols which takes a calling context\r\n  and determines if the module symbol is visible and accessible from that\r\n  calling context based on if the module is private or public and where it\r\n  was defined in relation to the calling context.\r\n\r\ncompiler/passes/scopeResolve.cpp, compiler/resolution/functionResolution.cpp\r\n  Add calls to ModuleSymbol::isVisible to determine if a use is valid in the\r\n  current context, if a symbol can be found or is inaccessible, and if a module\r\n  (named A) used by another module (named B) is available for searching\r\n  when B is used.  Since in scope resolution the first symbol(s) found could be\r\n  private, I've added a warning when that private symbol is not actually\r\n  available (due to being called from an outside scope) but would otherwise\r\n  be the best match."},"comment":{"url":"https://api.github.com/repos/chapel-lang/chapel/issues/comments/119325318","html_url":"https://github.com/chapel-lang/chapel/pull/2145#issuecomment-119325318","issue_url":"https://api.github.com/repos/chapel-lang/chapel/issues/2145","id":119325318,"user":{"login":"lydia-duncan","id":2454710,"avatar_url":"https://avatars.githubusercontent.com/u/2454710?v=3","gravatar_id":"","url":"https://api.github.com/users/lydia-duncan","html_url":"https://github.com/lydia-duncan","followers_url":"https://api.github.com/users/lydia-duncan/followers","following_url":"https://api.github.com/users/lydia-duncan/following{/other_user}","gists_url":"https://api.github.com/users/lydia-duncan/gists{/gist_id}","starred_url":"https://api.github.com/users/lydia-duncan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lydia-duncan/subscriptions","organizations_url":"https://api.github.com/users/lydia-duncan/orgs","repos_url":"https://api.github.com/users/lydia-duncan/repos","events_url":"https://api.github.com/users/lydia-duncan/events{/privacy}","received_events_url":"https://api.github.com/users/lydia-duncan/received_events","type":"User","site_admin":false},"created_at":"2015-07-07T20:22:43Z","updated_at":"2015-07-07T20:22:43Z","body":"@noakesmichael, would you mind reviewing?  The scopeResolve changes in the first couple of commits are not accurate to the end of the PR.\r\n\r\nNote that spec changes seemed like they would be large so they will occur in a separate pull request."}}