{"action":"created","comment":{"url":"https://api.github.com/repos/chapel-lang/chapel/pulls/comments/23562008","id":23562008,"diff_hunk":"@@ -386,8 +387,6 @@ static void build_chpl_entry_points() {\n   if (fLibraryCompile) {\n     if (chpl_user_main)\n       INT_FATAL(chpl_user_main, \"'main' found when compiling a library\");\n-    if (mainModules.n != 1)","path":"compiler/passes/buildDefaultFunctions.cpp","position":14,"original_position":14,"commit_id":"6c937fca77955ca57d93b618cd1969961e8ea73d","original_commit_id":"6c937fca77955ca57d93b618cd1969961e8ea73d","user":{"login":"hildeth","id":7853742,"avatar_url":"https://avatars.githubusercontent.com/u/7853742?v=3","gravatar_id":"","url":"https://api.github.com/users/hildeth","html_url":"https://github.com/hildeth","followers_url":"https://api.github.com/users/hildeth/followers","following_url":"https://api.github.com/users/hildeth/following{/other_user}","gists_url":"https://api.github.com/users/hildeth/gists{/gist_id}","starred_url":"https://api.github.com/users/hildeth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hildeth/subscriptions","organizations_url":"https://api.github.com/users/hildeth/orgs","repos_url":"https://api.github.com/users/hildeth/repos","events_url":"https://api.github.com/users/hildeth/events{/privacy}","received_events_url":"https://api.github.com/users/hildeth/received_events","type":"User","site_admin":false},"body":"I think I had the notion that a library would create a special initialization entry point, in which case it would be nice to be able to detect the \"root\" module automatically.  But the future implementor of that feature can insert consistency tests as need.  So, there is nothing lost (as far as I can see) in removing this check.","created_at":"2015-01-26T20:36:28Z","updated_at":"2015-01-26T20:36:28Z","html_url":"https://github.com/chapel-lang/chapel/pull/1174#discussion_r23562008","pull_request_url":"https://api.github.com/repos/chapel-lang/chapel/pulls/1174","_links":{"self":{"href":"https://api.github.com/repos/chapel-lang/chapel/pulls/comments/23562008"},"html":{"href":"https://github.com/chapel-lang/chapel/pull/1174#discussion_r23562008"},"pull_request":{"href":"https://api.github.com/repos/chapel-lang/chapel/pulls/1174"}}},"pull_request":{"url":"https://api.github.com/repos/chapel-lang/chapel/pulls/1174","id":28056189,"html_url":"https://github.com/chapel-lang/chapel/pull/1174","diff_url":"https://github.com/chapel-lang/chapel/pull/1174.diff","patch_url":"https://github.com/chapel-lang/chapel/pull/1174.patch","issue_url":"https://api.github.com/repos/chapel-lang/chapel/issues/1174","number":1174,"state":"open","locked":false,"title":"Change MOD_MAIN to a flag","user":{"login":"bradcray","id":7536222,"avatar_url":"https://avatars.githubusercontent.com/u/7536222?v=3","gravatar_id":"","url":"https://api.github.com/users/bradcray","html_url":"https://github.com/bradcray","followers_url":"https://api.github.com/users/bradcray/followers","following_url":"https://api.github.com/users/bradcray/following{/other_user}","gists_url":"https://api.github.com/users/bradcray/gists{/gist_id}","starred_url":"https://api.github.com/users/bradcray/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bradcray/subscriptions","organizations_url":"https://api.github.com/users/bradcray/orgs","repos_url":"https://api.github.com/users/bradcray/repos","events_url":"https://api.github.com/users/bradcray/events{/privacy}","received_events_url":"https://api.github.com/users/bradcray/received_events","type":"User","site_admin":false},"body":"We've traditionally had two conflicting notions of \"main module\" in the compiler's sources:\r\n\r\n1) The module that contains the main() entry point for the program and essentially represents where the program starts running from\r\n\r\n2) A module that comes from a file named by the user on the command line.  That is, if I type:\r\n\r\n    chpl foo.chpl bar.chpl \r\n\r\n(then all modules defined by foo and bar would have been tagged MOD_MAIN).\r\n\r\nThis second use of the term seemed confusing to me, and in most cases it isn't something we care about.  Most of the compiler treats these modules the same as MOD_USER (which currently designates a module that is outside of the $CHPL_HOME/modules/ hierarchy).  The one case where we currently treat it differently is in determining which module to use as the main module (using the first definition) in the event that only one such module meets that definition.  (I.e., if both foo.chpl and bar.chpl contained a main() function above, the compiler would complain; however, if I only compiled foo.chpl and the compiler picked up bar.chpl automatically to take care of a 'use bar' within foo.chpl, then bar.chpl wouldn't be considered as a candidate for the main module).\r\n\r\nFor these reasons, I proposed (on the Cray developers list) changing the tag to MOD_USER for consistency and to use a FLAG_ for the one case where we treat it differently.  For clarity, I called the flag FLAG_MODULE_FROM_COMMAND_LINE_FILE in hopes of more clearly stating the condition that MOD_MAIN previously did.\r\n\r\nFor the most part, this simplified the compiler.  My approach did have the downside of introducing a global variable in order to track whether we were currently parsing a module from a file named on the command line or not.  In my first approach, I tried to avoid this and to thread that state through various calls that needed to know, but unfortunately, this didn't add the flag as early as some of the logic in buildDefaultFunctions required it (resulting in a dozen failures or so).\r\n\r\n\r\nThinking about the module designations, it seems like it would be increasingly attractive to retire MOD_STANDARD as well, and to simply distinguish between internal modules and \"user\" ones (though perhaps this isn't the right term anymore).  I didn't have the time to undertake that this time around (nor to investigate whether there are ways in which we rely on MOD_STANDARD today that might suggest using a flag for that case as well), though, so am just noting it here as future work.","created_at":"2015-01-26T20:10:43Z","updated_at":"2015-01-26T20:36:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8888198817a29742cae55573011208c05b1f5bf5","assignee":{"login":"hildeth","id":7853742,"avatar_url":"https://avatars.githubusercontent.com/u/7853742?v=3","gravatar_id":"","url":"https://api.github.com/users/hildeth","html_url":"https://github.com/hildeth","followers_url":"https://api.github.com/users/hildeth/followers","following_url":"https://api.github.com/users/hildeth/following{/other_user}","gists_url":"https://api.github.com/users/hildeth/gists{/gist_id}","starred_url":"https://api.github.com/users/hildeth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hildeth/subscriptions","organizations_url":"https://api.github.com/users/hildeth/orgs","repos_url":"https://api.github.com/users/hildeth/repos","events_url":"https://api.github.com/users/hildeth/events{/privacy}","received_events_url":"https://api.github.com/users/hildeth/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/chapel-lang/chapel/pulls/1174/commits","review_comments_url":"https://api.github.com/repos/chapel-lang/chapel/pulls/1174/comments","review_comment_url":"https://api.github.com/repos/chapel-lang/chapel/pulls/comments/{number}","comments_url":"https://api.github.com/repos/chapel-lang/chapel/issues/1174/comments","statuses_url":"https://api.github.com/repos/chapel-lang/chapel/statuses/6c937fca77955ca57d93b618cd1969961e8ea73d","head":{"label":"bradcray:mod_main_to_flag","ref":"mod_main_to_flag","sha":"6c937fca77955ca57d93b618cd1969961e8ea73d","user":{"login":"bradcray","id":7536222,"avatar_url":"https://avatars.githubusercontent.com/u/7536222?v=3","gravatar_id":"","url":"https://api.github.com/users/bradcray","html_url":"https://github.com/bradcray","followers_url":"https://api.github.com/users/bradcray/followers","following_url":"https://api.github.com/users/bradcray/following{/other_user}","gists_url":"https://api.github.com/users/bradcray/gists{/gist_id}","starred_url":"https://api.github.com/users/bradcray/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bradcray/subscriptions","organizations_url":"https://api.github.com/users/bradcray/orgs","repos_url":"https://api.github.com/users/bradcray/repos","events_url":"https://api.github.com/users/bradcray/events{/privacy}","received_events_url":"https://api.github.com/users/bradcray/received_events","type":"User","site_admin":false},"repo":{"id":21837395,"name":"chapel","full_name":"bradcray/chapel","owner":{"login":"bradcray","id":7536222,"avatar_url":"https://avatars.githubusercontent.com/u/7536222?v=3","gravatar_id":"","url":"https://api.github.com/users/bradcray","html_url":"https://github.com/bradcray","followers_url":"https://api.github.com/users/bradcray/followers","following_url":"https://api.github.com/users/bradcray/following{/other_user}","gists_url":"https://api.github.com/users/bradcray/gists{/gist_id}","starred_url":"https://api.github.com/users/bradcray/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bradcray/subscriptions","organizations_url":"https://api.github.com/users/bradcray/orgs","repos_url":"https://api.github.com/users/bradcray/repos","events_url":"https://api.github.com/users/bradcray/events{/privacy}","received_events_url":"https://api.github.com/users/bradcray/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/bradcray/chapel","description":"a Productive Parallel Programming Language","fork":true,"url":"https://api.github.com/repos/bradcray/chapel","forks_url":"https://api.github.com/repos/bradcray/chapel/forks","keys_url":"https://api.github.com/repos/bradcray/chapel/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bradcray/chapel/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bradcray/chapel/teams","hooks_url":"https://api.github.com/repos/bradcray/chapel/hooks","issue_events_url":"https://api.github.com/repos/bradcray/chapel/issues/events{/number}","events_url":"https://api.github.com/repos/bradcray/chapel/events","assignees_url":"https://api.github.com/repos/bradcray/chapel/assignees{/user}","branches_url":"https://api.github.com/repos/bradcray/chapel/branches{/branch}","tags_url":"https://api.github.com/repos/bradcray/chapel/tags","blobs_url":"https://api.github.com/repos/bradcray/chapel/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bradcray/chapel/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bradcray/chapel/git/refs{/sha}","trees_url":"https://api.github.com/repos/bradcray/chapel/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bradcray/chapel/statuses/{sha}","languages_url":"https://api.github.com/repos/bradcray/chapel/languages","stargazers_url":"https://api.github.com/repos/bradcray/chapel/stargazers","contributors_url":"https://api.github.com/repos/bradcray/chapel/contributors","subscribers_url":"https://api.github.com/repos/bradcray/chapel/subscribers","subscription_url":"https://api.github.com/repos/bradcray/chapel/subscription","commits_url":"https://api.github.com/repos/bradcray/chapel/commits{/sha}","git_commits_url":"https://api.github.com/repos/bradcray/chapel/git/commits{/sha}","comments_url":"https://api.github.com/repos/bradcray/chapel/comments{/number}","issue_comment_url":"https://api.github.com/repos/bradcray/chapel/issues/comments/{number}","contents_url":"https://api.github.com/repos/bradcray/chapel/contents/{+path}","compare_url":"https://api.github.com/repos/bradcray/chapel/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bradcray/chapel/merges","archive_url":"https://api.github.com/repos/bradcray/chapel/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bradcray/chapel/downloads","issues_url":"https://api.github.com/repos/bradcray/chapel/issues{/number}","pulls_url":"https://api.github.com/repos/bradcray/chapel/pulls{/number}","milestones_url":"https://api.github.com/repos/bradcray/chapel/milestones{/number}","notifications_url":"https://api.github.com/repos/bradcray/chapel/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bradcray/chapel/labels{/name}","releases_url":"https://api.github.com/repos/bradcray/chapel/releases{/id}","created_at":"2014-07-14T22:08:29Z","updated_at":"2014-12-20T01:59:40Z","pushed_at":"2015-01-26T17:54:43Z","git_url":"git://github.com/bradcray/chapel.git","ssh_url":"git@github.com:bradcray/chapel.git","clone_url":"https://github.com/bradcray/chapel.git","svn_url":"https://github.com/bradcray/chapel","homepage":"http://chapel.cray.com/","size":258749,"stargazers_count":1,"watchers_count":1,"language":"Chapel","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"chapel-lang:master","ref":"master","sha":"06eb69b0979c9051ee999ad10e01ce98e265bab8","user":{"login":"chapel-lang","id":7597261,"avatar_url":"https://avatars.githubusercontent.com/u/7597261?v=3","gravatar_id":"","url":"https://api.github.com/users/chapel-lang","html_url":"https://github.com/chapel-lang","followers_url":"https://api.github.com/users/chapel-lang/followers","following_url":"https://api.github.com/users/chapel-lang/following{/other_user}","gists_url":"https://api.github.com/users/chapel-lang/gists{/gist_id}","starred_url":"https://api.github.com/users/chapel-lang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chapel-lang/subscriptions","organizations_url":"https://api.github.com/users/chapel-lang/orgs","repos_url":"https://api.github.com/users/chapel-lang/repos","events_url":"https://api.github.com/users/chapel-lang/events{/privacy}","received_events_url":"https://api.github.com/users/chapel-lang/received_events","type":"Organization","site_admin":false},"repo":{"id":21663285,"name":"chapel","full_name":"chapel-lang/chapel","owner":{"login":"chapel-lang","id":7597261,"avatar_url":"https://avatars.githubusercontent.com/u/7597261?v=3","gravatar_id":"","url":"https://api.github.com/users/chapel-lang","html_url":"https://github.com/chapel-lang","followers_url":"https://api.github.com/users/chapel-lang/followers","following_url":"https://api.github.com/users/chapel-lang/following{/other_user}","gists_url":"https://api.github.com/users/chapel-lang/gists{/gist_id}","starred_url":"https://api.github.com/users/chapel-lang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chapel-lang/subscriptions","organizations_url":"https://api.github.com/users/chapel-lang/orgs","repos_url":"https://api.github.com/users/chapel-lang/repos","events_url":"https://api.github.com/users/chapel-lang/events{/privacy}","received_events_url":"https://api.github.com/users/chapel-lang/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/chapel-lang/chapel","description":"a Productive Parallel Programming Language","fork":false,"url":"https://api.github.com/repos/chapel-lang/chapel","forks_url":"https://api.github.com/repos/chapel-lang/chapel/forks","keys_url":"https://api.github.com/repos/chapel-lang/chapel/keys{/key_id}","collaborators_url":"https://api.github.com/repos/chapel-lang/chapel/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/chapel-lang/chapel/teams","hooks_url":"https://api.github.com/repos/chapel-lang/chapel/hooks","issue_events_url":"https://api.github.com/repos/chapel-lang/chapel/issues/events{/number}","events_url":"https://api.github.com/repos/chapel-lang/chapel/events","assignees_url":"https://api.github.com/repos/chapel-lang/chapel/assignees{/user}","branches_url":"https://api.github.com/repos/chapel-lang/chapel/branches{/branch}","tags_url":"https://api.github.com/repos/chapel-lang/chapel/tags","blobs_url":"https://api.github.com/repos/chapel-lang/chapel/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/chapel-lang/chapel/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/chapel-lang/chapel/git/refs{/sha}","trees_url":"https://api.github.com/repos/chapel-lang/chapel/git/trees{/sha}","statuses_url":"https://api.github.com/repos/chapel-lang/chapel/statuses/{sha}","languages_url":"https://api.github.com/repos/chapel-lang/chapel/languages","stargazers_url":"https://api.github.com/repos/chapel-lang/chapel/stargazers","contributors_url":"https://api.github.com/repos/chapel-lang/chapel/contributors","subscribers_url":"https://api.github.com/repos/chapel-lang/chapel/subscribers","subscription_url":"https://api.github.com/repos/chapel-lang/chapel/subscription","commits_url":"https://api.github.com/repos/chapel-lang/chapel/commits{/sha}","git_commits_url":"https://api.github.com/repos/chapel-lang/chapel/git/commits{/sha}","comments_url":"https://api.github.com/repos/chapel-lang/chapel/comments{/number}","issue_comment_url":"https://api.github.com/repos/chapel-lang/chapel/issues/comments/{number}","contents_url":"https://api.github.com/repos/chapel-lang/chapel/contents/{+path}","compare_url":"https://api.github.com/repos/chapel-lang/chapel/compare/{base}...{head}","merges_url":"https://api.github.com/repos/chapel-lang/chapel/merges","archive_url":"https://api.github.com/repos/chapel-lang/chapel/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/chapel-lang/chapel/downloads","issues_url":"https://api.github.com/repos/chapel-lang/chapel/issues{/number}","pulls_url":"https://api.github.com/repos/chapel-lang/chapel/pulls{/number}","milestones_url":"https://api.github.com/repos/chapel-lang/chapel/milestones{/number}","notifications_url":"https://api.github.com/repos/chapel-lang/chapel/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/chapel-lang/chapel/labels{/name}","releases_url":"https://api.github.com/repos/chapel-lang/chapel/releases{/id}","created_at":"2014-07-09T18:15:54Z","updated_at":"2015-01-26T19:57:10Z","pushed_at":"2015-01-26T19:12:29Z","git_url":"git://github.com/chapel-lang/chapel.git","ssh_url":"git@github.com:chapel-lang/chapel.git","clone_url":"https://github.com/chapel-lang/chapel.git","svn_url":"https://github.com/chapel-lang/chapel","homepage":"http://chapel.cray.com/","size":328297,"stargazers_count":62,"watchers_count":62,"language":"Chapel","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":36,"mirror_url":null,"open_issues_count":13,"forks":36,"open_issues":13,"watchers":62,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/chapel-lang/chapel/pulls/1174"},"html":{"href":"https://github.com/chapel-lang/chapel/pull/1174"},"issue":{"href":"https://api.github.com/repos/chapel-lang/chapel/issues/1174"},"comments":{"href":"https://api.github.com/repos/chapel-lang/chapel/issues/1174/comments"},"review_comments":{"href":"https://api.github.com/repos/chapel-lang/chapel/pulls/1174/comments"},"review_comment":{"href":"https://api.github.com/repos/chapel-lang/chapel/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/chapel-lang/chapel/pulls/1174/commits"},"statuses":{"href":"https://api.github.com/repos/chapel-lang/chapel/statuses/6c937fca77955ca57d93b618cd1969961e8ea73d"}}}}