{"action":"created","issue":{"url":"https://api.github.com/repos/rubberduck-vba/Rubberduck/issues/1717","repository_url":"https://api.github.com/repos/rubberduck-vba/Rubberduck","labels_url":"https://api.github.com/repos/rubberduck-vba/Rubberduck/issues/1717/labels{/name}","comments_url":"https://api.github.com/repos/rubberduck-vba/Rubberduck/issues/1717/comments","events_url":"https://api.github.com/repos/rubberduck-vba/Rubberduck/issues/1717/events","html_url":"https://github.com/rubberduck-vba/Rubberduck/issues/1717","id":158746594,"number":1717,"title":"ByRef parameter is passed by value","user":{"login":"retailcoder","id":5751684,"avatar_url":"https://avatars.githubusercontent.com/u/5751684?v=3","gravatar_id":"","url":"https://api.github.com/users/retailcoder","html_url":"https://github.com/retailcoder","followers_url":"https://api.github.com/users/retailcoder/followers","following_url":"https://api.github.com/users/retailcoder/following{/other_user}","gists_url":"https://api.github.com/users/retailcoder/gists{/gist_id}","starred_url":"https://api.github.com/users/retailcoder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/retailcoder/subscriptions","organizations_url":"https://api.github.com/users/retailcoder/orgs","repos_url":"https://api.github.com/users/retailcoder/repos","events_url":"https://api.github.com/users/retailcoder/events{/privacy}","received_events_url":"https://api.github.com/users/retailcoder/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/rubberduck-vba/Rubberduck/labels/code-inspections","name":"code-inspections","color":"DDDDDd"},{"url":"https://api.github.com/repos/rubberduck-vba/Rubberduck/labels/feature-request","name":"feature-request","color":"fefefe"},{"url":"https://api.github.com/repos/rubberduck-vba/Rubberduck/labels/up-for-grabs","name":"up-for-grabs","color":"009800"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/rubberduck-vba/Rubberduck/milestones/21","html_url":"https://github.com/rubberduck-vba/Rubberduck/milestones/v2.1","labels_url":"https://api.github.com/repos/rubberduck-vba/Rubberduck/milestones/21/labels","id":1473801,"number":21,"title":"v2.1","description":"First minor update of 2.0","creator":{"login":"retailcoder","id":5751684,"avatar_url":"https://avatars.githubusercontent.com/u/5751684?v=3","gravatar_id":"","url":"https://api.github.com/users/retailcoder","html_url":"https://github.com/retailcoder","followers_url":"https://api.github.com/users/retailcoder/followers","following_url":"https://api.github.com/users/retailcoder/following{/other_user}","gists_url":"https://api.github.com/users/retailcoder/gists{/gist_id}","starred_url":"https://api.github.com/users/retailcoder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/retailcoder/subscriptions","organizations_url":"https://api.github.com/users/retailcoder/orgs","repos_url":"https://api.github.com/users/retailcoder/repos","events_url":"https://api.github.com/users/retailcoder/events{/privacy}","received_events_url":"https://api.github.com/users/retailcoder/received_events","type":"User","site_admin":false},"open_issues":30,"closed_issues":2,"state":"open","created_at":"2015-12-24T17:00:35Z","updated_at":"2016-06-06T18:46:05Z","due_on":null,"closed_at":null},"comments":1,"created_at":"2016-06-06T18:46:04Z","updated_at":"2016-06-06T18:52:06Z","closed_at":null,"body":"Given:\r\n\r\n    Sub DoSomething(ByRef foo As Integer)\r\n        foo = 42\r\n    End Sub\r\n\r\nThen this code:\r\n\r\n    DoSomething (bar)\r\n\r\nPasses `bar` by value (`ByVal`), which can lead to unexpected bugs, as demonstrated with this code:\r\n\r\n    Sub Test()\r\n        Dim bar As Integer\r\n        DoSomething (bar)\r\n        Debug.Print \"Back into 'Test', bar is \" & bar\r\n    End Sub\r\n    \r\n    Sub DoSomething(ByRef foo As Integer)\r\n        foo = 42\r\n        Debug.Print \"In 'DoSomething', foo is \" & foo\r\n    End Sub\r\n\r\nThe output is as follows:\r\n\r\n    In 'DoSomething', foo is 42\r\n    Back into 'Test', bar is 0\r\n\r\nWithout the parentheses around `(bar)`, the output is as expected:\r\n\r\n    In 'DoSomething', foo is 42\r\n    Back into 'Test', bar is 42\r\n\r\nWe need an inspection that locates `ByRef` arguments being force-passed by value, and suggests removing the extraneous parentheses."},"comment":{"url":"https://api.github.com/repos/rubberduck-vba/Rubberduck/issues/comments/224052416","html_url":"https://github.com/rubberduck-vba/Rubberduck/issues/1717#issuecomment-224052416","issue_url":"https://api.github.com/repos/rubberduck-vba/Rubberduck/issues/1717","id":224052416,"user":{"login":"joshuader6","id":10895412,"avatar_url":"https://avatars.githubusercontent.com/u/10895412?v=3","gravatar_id":"","url":"https://api.github.com/users/joshuader6","html_url":"https://github.com/joshuader6","followers_url":"https://api.github.com/users/joshuader6/followers","following_url":"https://api.github.com/users/joshuader6/following{/other_user}","gists_url":"https://api.github.com/users/joshuader6/gists{/gist_id}","starred_url":"https://api.github.com/users/joshuader6/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joshuader6/subscriptions","organizations_url":"https://api.github.com/users/joshuader6/orgs","repos_url":"https://api.github.com/users/joshuader6/repos","events_url":"https://api.github.com/users/joshuader6/events{/privacy}","received_events_url":"https://api.github.com/users/joshuader6/received_events","type":"User","site_admin":false},"created_at":"2016-06-06T18:52:06Z","updated_at":"2016-06-06T18:52:06Z","body":"this is .... why is this ?? ... why is vba doing things ?? so basically you say \r\n`DoSomething(bar) `= byval\r\n`DoSomething bar` = byref\r\n\r\nbut what if \r\n\r\n`if somefunction(byrefarg) = true then ... ` <-- there the parentheses is mandatory\r\n"}}
{"actor":{"display_login":"joshuader6"}}