{"action":"created","issue":{"url":"https://api.github.com/repos/bbatsov/ruby-style-guide/issues/511","repository_url":"https://api.github.com/repos/bbatsov/ruby-style-guide","labels_url":"https://api.github.com/repos/bbatsov/ruby-style-guide/issues/511/labels{/name}","comments_url":"https://api.github.com/repos/bbatsov/ruby-style-guide/issues/511/comments","events_url":"https://api.github.com/repos/bbatsov/ruby-style-guide/issues/511/events","html_url":"https://github.com/bbatsov/ruby-style-guide/issues/511","id":119756133,"number":511,"title":"Statement regarding the use of self is very misleading, if not strictly false","user":{"login":"adrianomitre","id":456804,"avatar_url":"https://avatars.githubusercontent.com/u/456804?v=3","gravatar_id":"","url":"https://api.github.com/users/adrianomitre","html_url":"https://github.com/adrianomitre","followers_url":"https://api.github.com/users/adrianomitre/followers","following_url":"https://api.github.com/users/adrianomitre/following{/other_user}","gists_url":"https://api.github.com/users/adrianomitre/gists{/gist_id}","starred_url":"https://api.github.com/users/adrianomitre/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adrianomitre/subscriptions","organizations_url":"https://api.github.com/users/adrianomitre/orgs","repos_url":"https://api.github.com/users/adrianomitre/repos","events_url":"https://api.github.com/users/adrianomitre/events{/privacy}","received_events_url":"https://api.github.com/users/adrianomitre/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":12,"created_at":"2015-12-01T16:35:17Z","updated_at":"2016-10-06T00:15:50Z","closed_at":null,"body":"The statement \"It is only required when calling a self write accessor.\" in the context of [Avoid self where not required.](https://github.com/bbatsov/ruby-style-guide#no-self-unless-required) is (almost) false. There are at least one other case where `self.` is (almost) required: `self.class`.\r\n\r\n`class` by itself is a keyword for class definition, and `self.class` invokes Kernel#class method, which returns the class of the caller. Replacing `self.class` by `class` result in a `SyntaxError: unexpected keyword_end`).\r\n\r\nYeah, sure, one can substitute `self.class` by `send(:class)`, but so can one replace the write accessor `self.varname = value` by `send(\"varname=\", value)`, thus I believe the original statement is very misleading, if not strictly false. I therefore suggest rewriting the sentence as \"It is only required when calling a self write accessor or Kernel#class.\""},"comment":{"url":"https://api.github.com/repos/bbatsov/ruby-style-guide/issues/comments/251835604","html_url":"https://github.com/bbatsov/ruby-style-guide/issues/511#issuecomment-251835604","issue_url":"https://api.github.com/repos/bbatsov/ruby-style-guide/issues/511","id":251835604,"user":{"login":"adrianomitre","id":456804,"avatar_url":"https://avatars.githubusercontent.com/u/456804?v=3","gravatar_id":"","url":"https://api.github.com/users/adrianomitre","html_url":"https://github.com/adrianomitre","followers_url":"https://api.github.com/users/adrianomitre/followers","following_url":"https://api.github.com/users/adrianomitre/following{/other_user}","gists_url":"https://api.github.com/users/adrianomitre/gists{/gist_id}","starred_url":"https://api.github.com/users/adrianomitre/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adrianomitre/subscriptions","organizations_url":"https://api.github.com/users/adrianomitre/orgs","repos_url":"https://api.github.com/users/adrianomitre/repos","events_url":"https://api.github.com/users/adrianomitre/events{/privacy}","received_events_url":"https://api.github.com/users/adrianomitre/received_events","type":"User","site_admin":false},"created_at":"2016-10-06T00:15:50Z","updated_at":"2016-10-06T00:15:50Z","body":"My final proposal: \"Avoid `self` where not required. (It is only required when calling a self write accessor, methods named after reserved words, or overloadable operators.)\"\r\n\r\nUpdated my [pull request](https://github.com/bbatsov/ruby-style-guide/pull/530)."}}
{"actor":{"display_login":"adrianomitre"}}