{"action":"created","issue":{"url":"https://api.github.com/repos/juttle/juttle/issues/460","repository_url":"https://api.github.com/repos/juttle/juttle","labels_url":"https://api.github.com/repos/juttle/juttle/issues/460/labels{/name}","comments_url":"https://api.github.com/repos/juttle/juttle/issues/460/comments","events_url":"https://api.github.com/repos/juttle/juttle/issues/460/events","html_url":"https://github.com/juttle/juttle/pull/460","id":136385412,"number":460,"title":"Semantic: Kill “opts”","user":{"login":"dmajda","id":18821,"avatar_url":"https://avatars.githubusercontent.com/u/18821?v=3","gravatar_id":"","url":"https://api.github.com/users/dmajda","html_url":"https://github.com/dmajda","followers_url":"https://api.github.com/users/dmajda/followers","following_url":"https://api.github.com/users/dmajda/following{/other_user}","gists_url":"https://api.github.com/users/dmajda/gists{/gist_id}","starred_url":"https://api.github.com/users/dmajda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmajda/subscriptions","organizations_url":"https://api.github.com/users/dmajda/orgs","repos_url":"https://api.github.com/users/dmajda/repos","events_url":"https://api.github.com/users/dmajda/events{/privacy}","received_events_url":"https://api.github.com/users/dmajda/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/juttle/juttle/labels/in%20progress","name":"in progress","color":"ffa500"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-02-25T13:18:25Z","updated_at":"2016-02-25T13:18:32Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/juttle/juttle/pulls/460","html_url":"https://github.com/juttle/juttle/pull/460","diff_url":"https://github.com/juttle/juttle/pull/460.diff","patch_url":"https://github.com/juttle/juttle/pull/460.patch"},"body":"The high-level idea of this PR is to stop using the `opts` parameter to pass context around in the semantic pass and replace it by instance variables.\r\n\r\nIn general, passing context around using a parameter leads to unnecessarily verbose code and [can lead to performance problems](https://github.com/pegjs/pegjs/commit/cdeecf750f8a3f781459ed817815a537392993c1) when done properly (the context ends up being copied often so that child nodes don’t modify parents’ context).\r\n\r\nIn the particular case of semantic pass, the `opts` parameter was also used inconsistently, which made related code was brittle and bug-prone. Using an instance variable ensures the context is defined everywhere and is set in more controlled manner.\r\n\r\nNote the instance variables and helper methods introduced in this PR probably aren’t the final form — there is a `Context` class hiding here :-) But we’ll see what we’ll need after the semantic pass gets converted to a visitor and split into multiple passes.\r\n\r\nPrep work for #419."},"comment":{"url":"https://api.github.com/repos/juttle/juttle/issues/comments/188781680","html_url":"https://github.com/juttle/juttle/pull/460#issuecomment-188781680","issue_url":"https://api.github.com/repos/juttle/juttle/issues/460","id":188781680,"user":{"login":"dmajda","id":18821,"avatar_url":"https://avatars.githubusercontent.com/u/18821?v=3","gravatar_id":"","url":"https://api.github.com/users/dmajda","html_url":"https://github.com/dmajda","followers_url":"https://api.github.com/users/dmajda/followers","following_url":"https://api.github.com/users/dmajda/following{/other_user}","gists_url":"https://api.github.com/users/dmajda/gists{/gist_id}","starred_url":"https://api.github.com/users/dmajda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmajda/subscriptions","organizations_url":"https://api.github.com/users/dmajda/orgs","repos_url":"https://api.github.com/users/dmajda/repos","events_url":"https://api.github.com/users/dmajda/events{/privacy}","received_events_url":"https://api.github.com/users/dmajda/received_events","type":"User","site_admin":false},"created_at":"2016-02-25T13:18:32Z","updated_at":"2016-02-25T13:18:32Z","body":"@bkutil"}}