{"action":"created","comment":{"url":"https://api.github.com/repos/stevengj/SoftGlobalScope.jl/pulls/comments/243859666","pull_request_review_id":187732453,"id":243859666,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDI0Mzg1OTY2Ng==","diff_hunk":"@@ -152,8 +152,21 @@ else\n             return Expr(ex.head, (_softscope.(ex.args, Ref(globals), Ref(locals), insertglobal))...)\n         elseif isexpr(ex, :kw)\n             return Expr(ex.head, ex.args[1], _softscope(ex.args[2], globals, locals, insertglobal))\n-        elseif insertglobal && ex.head in assignments && ex.args[1] in globals && !(ex.args[1] in locals)\n-            return Expr(:global, Expr(ex.head, ex.args[1], _softscope(ex.args[2], globals, locals, insertglobal)))\n+        elseif insertglobal && ex.head in assignments \n+            if ex.args[1] in globals && !(ex.args[1] in locals)\n+                # Simple assignment\n+                return Expr(:global, Expr(ex.head, ex.args[1], _softscope(ex.args[2], globals, locals, insertglobal)))\n+            elseif isexpr(ex.args[1], :tuple)\n+                # Assignment to a tuple\n+                vars = [var for var in localvars(ex.args[1].args) if (var in globals) && !(var in locals)]\n+                if length(vars) > 0\n+                    return Expr(:block, Expr(:global, vars...), Expr(ex.head, ex.args[1], _softscope(ex.args[2], globals, locals, insertglobal)))\n+                else\n+                    return Expr(ex.head, ex.args[1], _softscope(ex.args[2], globals, locals, insertglobal))\n+                end\n+            else\n+                return ex","path":"src/SoftGlobalScope.jl","position":null,"original_position":19,"commit_id":"f03a5131349760f52d6187f2fb6b19aba2f85d4c","original_commit_id":"a12f0b7011c745e9381b0d0ae25987e482f98154","user":{"login":"dawbarton","id":1260244,"node_id":"MDQ6VXNlcjEyNjAyNDQ=","avatar_url":"https://avatars3.githubusercontent.com/u/1260244?v=4","gravatar_id":"","url":"https://api.github.com/users/dawbarton","html_url":"https://github.com/dawbarton","followers_url":"https://api.github.com/users/dawbarton/followers","following_url":"https://api.github.com/users/dawbarton/following{/other_user}","gists_url":"https://api.github.com/users/dawbarton/gists{/gist_id}","starred_url":"https://api.github.com/users/dawbarton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dawbarton/subscriptions","organizations_url":"https://api.github.com/users/dawbarton/orgs","repos_url":"https://api.github.com/users/dawbarton/repos","events_url":"https://api.github.com/users/dawbarton/events{/privacy}","received_events_url":"https://api.github.com/users/dawbarton/received_events","type":"User","site_admin":false},"body":"That needs a few `Ref`s to allow broadcasting properly (added). \r\n\r\nAlso it breaks `let; f(a) = (a = 1); end` since it softscopes the function definition when it shouldn't. That's easy enough to fix (done). \r\n\r\nAlso, softscope needs to understand `:ref`s to do `a[global b += 1] = 1` (also done). \r\n\r\nHowever, getting your test case to work properly is more difficult since it requires softscoping a tuple which isn't a simple recursive fix since assignment within a tuple can create a named tuple under the right circumstances. It's probably not that hard but I'm out of time at the moment. (Personally I'd ignore this case as it's not a particularly common use case as far as I'm aware.)","created_at":"2018-12-24T21:53:38Z","updated_at":"2018-12-24T21:53:38Z","html_url":"https://github.com/stevengj/SoftGlobalScope.jl/pull/19#discussion_r243859666","pull_request_url":"https://api.github.com/repos/stevengj/SoftGlobalScope.jl/pulls/19","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/stevengj/SoftGlobalScope.jl/pulls/comments/243859666"},"html":{"href":"https://github.com/stevengj/SoftGlobalScope.jl/pull/19#discussion_r243859666"},"pull_request":{"href":"https://api.github.com/repos/stevengj/SoftGlobalScope.jl/pulls/19"}},"in_reply_to_id":243831356},"pull_request":{"url":"https://api.github.com/repos/stevengj/SoftGlobalScope.jl/pulls/19","id":240598449,"node_id":"MDExOlB1bGxSZXF1ZXN0MjQwNTk4NDQ5","html_url":"https://github.com/stevengj/SoftGlobalScope.jl/pull/19","diff_url":"https://github.com/stevengj/SoftGlobalScope.jl/pull/19.diff","patch_url":"https://github.com/stevengj/SoftGlobalScope.jl/pull/19.patch","issue_url":"https://api.github.com/repos/stevengj/SoftGlobalScope.jl/issues/19","number":19,"state":"open","locked":false,"title":"Add tuple assignments","user":{"login":"dawbarton","id":1260244,"node_id":"MDQ6VXNlcjEyNjAyNDQ=","avatar_url":"https://avatars3.githubusercontent.com/u/1260244?v=4","gravatar_id":"","url":"https://api.github.com/users/dawbarton","html_url":"https://github.com/dawbarton","followers_url":"https://api.github.com/users/dawbarton/followers","following_url":"https://api.github.com/users/dawbarton/following{/other_user}","gists_url":"https://api.github.com/users/dawbarton/gists{/gist_id}","starred_url":"https://api.github.com/users/dawbarton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dawbarton/subscriptions","organizations_url":"https://api.github.com/users/dawbarton/orgs","repos_url":"https://api.github.com/users/dawbarton/repos","events_url":"https://api.github.com/users/dawbarton/events{/privacy}","received_events_url":"https://api.github.com/users/dawbarton/received_events","type":"User","site_admin":false},"body":"A quick WIP for #17. Doesn't quite work... Just thought I'd share this now as not sure when I'll next have a few minutes.\r\n\r\nKey point is that we cannot add the global annotation inside a tuple assignment and so we have to create an extra block with an explicit global declaration.","created_at":"2018-12-21T23:25:02Z","updated_at":"2018-12-24T21:53:38Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a7e34a9d22cf552ec4c45190beebe5fc6278f0ad","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/stevengj/SoftGlobalScope.jl/pulls/19/commits","review_comments_url":"https://api.github.com/repos/stevengj/SoftGlobalScope.jl/pulls/19/comments","review_comment_url":"https://api.github.com/repos/stevengj/SoftGlobalScope.jl/pulls/comments{/number}","comments_url":"https://api.github.com/repos/stevengj/SoftGlobalScope.jl/issues/19/comments","statuses_url":"https://api.github.com/repos/stevengj/SoftGlobalScope.jl/statuses/f03a5131349760f52d6187f2fb6b19aba2f85d4c","head":{"label":"dawbarton:tupleassignment","ref":"tupleassignment","sha":"f03a5131349760f52d6187f2fb6b19aba2f85d4c","user":{"login":"dawbarton","id":1260244,"node_id":"MDQ6VXNlcjEyNjAyNDQ=","avatar_url":"https://avatars3.githubusercontent.com/u/1260244?v=4","gravatar_id":"","url":"https://api.github.com/users/dawbarton","html_url":"https://github.com/dawbarton","followers_url":"https://api.github.com/users/dawbarton/followers","following_url":"https://api.github.com/users/dawbarton/following{/other_user}","gists_url":"https://api.github.com/users/dawbarton/gists{/gist_id}","starred_url":"https://api.github.com/users/dawbarton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dawbarton/subscriptions","organizations_url":"https://api.github.com/users/dawbarton/orgs","repos_url":"https://api.github.com/users/dawbarton/repos","events_url":"https://api.github.com/users/dawbarton/events{/privacy}","received_events_url":"https://api.github.com/users/dawbarton/received_events","type":"User","site_admin":false},"repo":{"id":145772019,"node_id":"MDEwOlJlcG9zaXRvcnkxNDU3NzIwMTk=","name":"SoftGlobalScope.jl","full_name":"dawbarton/SoftGlobalScope.jl","private":false,"owner":{"login":"dawbarton","id":1260244,"node_id":"MDQ6VXNlcjEyNjAyNDQ=","avatar_url":"https://avatars3.githubusercontent.com/u/1260244?v=4","gravatar_id":"","url":"https://api.github.com/users/dawbarton","html_url":"https://github.com/dawbarton","followers_url":"https://api.github.com/users/dawbarton/followers","following_url":"https://api.github.com/users/dawbarton/following{/other_user}","gists_url":"https://api.github.com/users/dawbarton/gists{/gist_id}","starred_url":"https://api.github.com/users/dawbarton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dawbarton/subscriptions","organizations_url":"https://api.github.com/users/dawbarton/orgs","repos_url":"https://api.github.com/users/dawbarton/repos","events_url":"https://api.github.com/users/dawbarton/events{/privacy}","received_events_url":"https://api.github.com/users/dawbarton/received_events","type":"User","site_admin":false},"html_url":"https://github.com/dawbarton/SoftGlobalScope.jl","description":"utilities for \"soft\" global scope in interactive Julia environments","fork":true,"url":"https://api.github.com/repos/dawbarton/SoftGlobalScope.jl","forks_url":"https://api.github.com/repos/dawbarton/SoftGlobalScope.jl/forks","keys_url":"https://api.github.com/repos/dawbarton/SoftGlobalScope.jl/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dawbarton/SoftGlobalScope.jl/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dawbarton/SoftGlobalScope.jl/teams","hooks_url":"https://api.github.com/repos/dawbarton/SoftGlobalScope.jl/hooks","issue_events_url":"https://api.github.com/repos/dawbarton/SoftGlobalScope.jl/issues/events{/number}","events_url":"https://api.github.com/repos/dawbarton/SoftGlobalScope.jl/events","assignees_url":"https://api.github.com/repos/dawbarton/SoftGlobalScope.jl/assignees{/user}","branches_url":"https://api.github.com/repos/dawbarton/SoftGlobalScope.jl/branches{/branch}","tags_url":"https://api.github.com/repos/dawbarton/SoftGlobalScope.jl/tags","blobs_url":"https://api.github.com/repos/dawbarton/SoftGlobalScope.jl/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dawbarton/SoftGlobalScope.jl/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dawbarton/SoftGlobalScope.jl/git/refs{/sha}","trees_url":"https://api.github.com/repos/dawbarton/SoftGlobalScope.jl/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dawbarton/SoftGlobalScope.jl/statuses/{sha}","languages_url":"https://api.github.com/repos/dawbarton/SoftGlobalScope.jl/languages","stargazers_url":"https://api.github.com/repos/dawbarton/SoftGlobalScope.jl/stargazers","contributors_url":"https://api.github.com/repos/dawbarton/SoftGlobalScope.jl/contributors","subscribers_url":"https://api.github.com/repos/dawbarton/SoftGlobalScope.jl/subscribers","subscription_url":"https://api.github.com/repos/dawbarton/SoftGlobalScope.jl/subscription","commits_url":"https://api.github.com/repos/dawbarton/SoftGlobalScope.jl/commits{/sha}","git_commits_url":"https://api.github.com/repos/dawbarton/SoftGlobalScope.jl/git/commits{/sha}","comments_url":"https://api.github.com/repos/dawbarton/SoftGlobalScope.jl/comments{/number}","issue_comment_url":"https://api.github.com/repos/dawbarton/SoftGlobalScope.jl/issues/comments{/number}","contents_url":"https://api.github.com/repos/dawbarton/SoftGlobalScope.jl/contents/{+path}","compare_url":"https://api.github.com/repos/dawbarton/SoftGlobalScope.jl/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dawbarton/SoftGlobalScope.jl/merges","archive_url":"https://api.github.com/repos/dawbarton/SoftGlobalScope.jl/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dawbarton/SoftGlobalScope.jl/downloads","issues_url":"https://api.github.com/repos/dawbarton/SoftGlobalScope.jl/issues{/number}","pulls_url":"https://api.github.com/repos/dawbarton/SoftGlobalScope.jl/pulls{/number}","milestones_url":"https://api.github.com/repos/dawbarton/SoftGlobalScope.jl/milestones{/number}","notifications_url":"https://api.github.com/repos/dawbarton/SoftGlobalScope.jl/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dawbarton/SoftGlobalScope.jl/labels{/name}","releases_url":"https://api.github.com/repos/dawbarton/SoftGlobalScope.jl/releases{/id}","deployments_url":"https://api.github.com/repos/dawbarton/SoftGlobalScope.jl/deployments","created_at":"2018-08-22T23:05:33Z","updated_at":"2018-12-21T20:49:46Z","pushed_at":"2018-12-24T21:46:53Z","git_url":"git://github.com/dawbarton/SoftGlobalScope.jl.git","ssh_url":"git@github.com:dawbarton/SoftGlobalScope.jl.git","clone_url":"https://github.com/dawbarton/SoftGlobalScope.jl.git","svn_url":"https://github.com/dawbarton/SoftGlobalScope.jl","homepage":null,"size":33,"stargazers_count":0,"watchers_count":0,"language":"Julia","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"stevengj:master","ref":"master","sha":"ac58bed61973d82851a3c51d0de9e5b4ec0b4a66","user":{"login":"stevengj","id":2913679,"node_id":"MDQ6VXNlcjI5MTM2Nzk=","avatar_url":"https://avatars3.githubusercontent.com/u/2913679?v=4","gravatar_id":"","url":"https://api.github.com/users/stevengj","html_url":"https://github.com/stevengj","followers_url":"https://api.github.com/users/stevengj/followers","following_url":"https://api.github.com/users/stevengj/following{/other_user}","gists_url":"https://api.github.com/users/stevengj/gists{/gist_id}","starred_url":"https://api.github.com/users/stevengj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stevengj/subscriptions","organizations_url":"https://api.github.com/users/stevengj/orgs","repos_url":"https://api.github.com/users/stevengj/repos","events_url":"https://api.github.com/users/stevengj/events{/privacy}","received_events_url":"https://api.github.com/users/stevengj/received_events","type":"User","site_admin":false},"repo":{"id":145733763,"node_id":"MDEwOlJlcG9zaXRvcnkxNDU3MzM3NjM=","name":"SoftGlobalScope.jl","full_name":"stevengj/SoftGlobalScope.jl","private":false,"owner":{"login":"stevengj","id":2913679,"node_id":"MDQ6VXNlcjI5MTM2Nzk=","avatar_url":"https://avatars3.githubusercontent.com/u/2913679?v=4","gravatar_id":"","url":"https://api.github.com/users/stevengj","html_url":"https://github.com/stevengj","followers_url":"https://api.github.com/users/stevengj/followers","following_url":"https://api.github.com/users/stevengj/following{/other_user}","gists_url":"https://api.github.com/users/stevengj/gists{/gist_id}","starred_url":"https://api.github.com/users/stevengj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stevengj/subscriptions","organizations_url":"https://api.github.com/users/stevengj/orgs","repos_url":"https://api.github.com/users/stevengj/repos","events_url":"https://api.github.com/users/stevengj/events{/privacy}","received_events_url":"https://api.github.com/users/stevengj/received_events","type":"User","site_admin":false},"html_url":"https://github.com/stevengj/SoftGlobalScope.jl","description":"utilities for \"soft\" global scope in interactive Julia environments","fork":false,"url":"https://api.github.com/repos/stevengj/SoftGlobalScope.jl","forks_url":"https://api.github.com/repos/stevengj/SoftGlobalScope.jl/forks","keys_url":"https://api.github.com/repos/stevengj/SoftGlobalScope.jl/keys{/key_id}","collaborators_url":"https://api.github.com/repos/stevengj/SoftGlobalScope.jl/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/stevengj/SoftGlobalScope.jl/teams","hooks_url":"https://api.github.com/repos/stevengj/SoftGlobalScope.jl/hooks","issue_events_url":"https://api.github.com/repos/stevengj/SoftGlobalScope.jl/issues/events{/number}","events_url":"https://api.github.com/repos/stevengj/SoftGlobalScope.jl/events","assignees_url":"https://api.github.com/repos/stevengj/SoftGlobalScope.jl/assignees{/user}","branches_url":"https://api.github.com/repos/stevengj/SoftGlobalScope.jl/branches{/branch}","tags_url":"https://api.github.com/repos/stevengj/SoftGlobalScope.jl/tags","blobs_url":"https://api.github.com/repos/stevengj/SoftGlobalScope.jl/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/stevengj/SoftGlobalScope.jl/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/stevengj/SoftGlobalScope.jl/git/refs{/sha}","trees_url":"https://api.github.com/repos/stevengj/SoftGlobalScope.jl/git/trees{/sha}","statuses_url":"https://api.github.com/repos/stevengj/SoftGlobalScope.jl/statuses/{sha}","languages_url":"https://api.github.com/repos/stevengj/SoftGlobalScope.jl/languages","stargazers_url":"https://api.github.com/repos/stevengj/SoftGlobalScope.jl/stargazers","contributors_url":"https://api.github.com/repos/stevengj/SoftGlobalScope.jl/contributors","subscribers_url":"https://api.github.com/repos/stevengj/SoftGlobalScope.jl/subscribers","subscription_url":"https://api.github.com/repos/stevengj/SoftGlobalScope.jl/subscription","commits_url":"https://api.github.com/repos/stevengj/SoftGlobalScope.jl/commits{/sha}","git_commits_url":"https://api.github.com/repos/stevengj/SoftGlobalScope.jl/git/commits{/sha}","comments_url":"https://api.github.com/repos/stevengj/SoftGlobalScope.jl/comments{/number}","issue_comment_url":"https://api.github.com/repos/stevengj/SoftGlobalScope.jl/issues/comments{/number}","contents_url":"https://api.github.com/repos/stevengj/SoftGlobalScope.jl/contents/{+path}","compare_url":"https://api.github.com/repos/stevengj/SoftGlobalScope.jl/compare/{base}...{head}","merges_url":"https://api.github.com/repos/stevengj/SoftGlobalScope.jl/merges","archive_url":"https://api.github.com/repos/stevengj/SoftGlobalScope.jl/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/stevengj/SoftGlobalScope.jl/downloads","issues_url":"https://api.github.com/repos/stevengj/SoftGlobalScope.jl/issues{/number}","pulls_url":"https://api.github.com/repos/stevengj/SoftGlobalScope.jl/pulls{/number}","milestones_url":"https://api.github.com/repos/stevengj/SoftGlobalScope.jl/milestones{/number}","notifications_url":"https://api.github.com/repos/stevengj/SoftGlobalScope.jl/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/stevengj/SoftGlobalScope.jl/labels{/name}","releases_url":"https://api.github.com/repos/stevengj/SoftGlobalScope.jl/releases{/id}","deployments_url":"https://api.github.com/repos/stevengj/SoftGlobalScope.jl/deployments","created_at":"2018-08-22T16:16:52Z","updated_at":"2018-12-19T22:00:15Z","pushed_at":"2018-12-24T21:46:54Z","git_url":"git://github.com/stevengj/SoftGlobalScope.jl.git","ssh_url":"git@github.com:stevengj/SoftGlobalScope.jl.git","clone_url":"https://github.com/stevengj/SoftGlobalScope.jl.git","svn_url":"https://github.com/stevengj/SoftGlobalScope.jl","homepage":null,"size":23,"stargazers_count":15,"watchers_count":15,"language":"Julia","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":5,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":1,"open_issues":5,"watchers":15,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/stevengj/SoftGlobalScope.jl/pulls/19"},"html":{"href":"https://github.com/stevengj/SoftGlobalScope.jl/pull/19"},"issue":{"href":"https://api.github.com/repos/stevengj/SoftGlobalScope.jl/issues/19"},"comments":{"href":"https://api.github.com/repos/stevengj/SoftGlobalScope.jl/issues/19/comments"},"review_comments":{"href":"https://api.github.com/repos/stevengj/SoftGlobalScope.jl/pulls/19/comments"},"review_comment":{"href":"https://api.github.com/repos/stevengj/SoftGlobalScope.jl/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/stevengj/SoftGlobalScope.jl/pulls/19/commits"},"statuses":{"href":"https://api.github.com/repos/stevengj/SoftGlobalScope.jl/statuses/f03a5131349760f52d6187f2fb6b19aba2f85d4c"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"dawbarton"}}