{"action":"created","issue":{"url":"https://api.github.com/repos/tc39/proposal-private-methods/issues/28","repository_url":"https://api.github.com/repos/tc39/proposal-private-methods","labels_url":"https://api.github.com/repos/tc39/proposal-private-methods/issues/28/labels{/name}","comments_url":"https://api.github.com/repos/tc39/proposal-private-methods/issues/28/comments","events_url":"https://api.github.com/repos/tc39/proposal-private-methods/issues/28/events","html_url":"https://github.com/tc39/proposal-private-methods/issues/28","id":306250831,"node_id":"MDU6SXNzdWUzMDYyNTA4MzE=","number":28,"title":"Yet another approach to a more JS-like syntax","user":{"login":"zocky","id":142641,"node_id":"MDQ6VXNlcjE0MjY0MQ==","avatar_url":"https://avatars0.githubusercontent.com/u/142641?v=4","gravatar_id":"","url":"https://api.github.com/users/zocky","html_url":"https://github.com/zocky","followers_url":"https://api.github.com/users/zocky/followers","following_url":"https://api.github.com/users/zocky/following{/other_user}","gists_url":"https://api.github.com/users/zocky/gists{/gist_id}","starred_url":"https://api.github.com/users/zocky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zocky/subscriptions","organizations_url":"https://api.github.com/users/zocky/orgs","repos_url":"https://api.github.com/users/zocky/repos","events_url":"https://api.github.com/users/zocky/events{/privacy}","received_events_url":"https://api.github.com/users/zocky/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":64,"created_at":"2018-03-18T15:37:40Z","updated_at":"2018-07-13T19:34:37Z","closed_at":null,"author_association":"NONE","body":"I realize I might be beating a dead horse, but it seems to me that I'm far from being the only one who intensely dislikes the use of # for private fields/methods. So here goes:\r\n\r\n1) Use the `private` keyword to introduce private field, methods, setters, getters, exactly as with `static`.\r\n2) Use bare field and method names without any qualifiers to access private fields and methods within the class's methods, just like we do now in factory functions, i.e. treat them like variables.\r\n3) Use `private.name` to explicitly access the private fields of this object, if there are conflicting names, just like we do with `super`. Also use `private[\"name\"]` for non-ident and calculated field names.\r\n4) Use `private(otherObject).name` or `private(otherObject)[\"name\"]`to access the private fields of another object of the same class. For symmetry, `private(this).x` is the same thing as `private(this)[\"x\"]` `private.x` or `private[\"x\"]` or just `x` if there's no variable `x` in scope.\r\n5) In methods, `private` and `private(otherObject)` are not valid constructs without being followed by `.field` or `[\"field\"]` and throw syntax errors.\r\n\r\nAFAICT, this achieves all the requirements, without introducing a wildly asymmetrical new syntax for private fields, AND gives us a natural way of reading code in human language, solving the naming problem that was brought up on other threads.\r\n"},"comment":{"url":"https://api.github.com/repos/tc39/proposal-private-methods/issues/comments/404932312","html_url":"https://github.com/tc39/proposal-private-methods/issues/28#issuecomment-404932312","issue_url":"https://api.github.com/repos/tc39/proposal-private-methods/issues/28","id":404932312,"node_id":"MDEyOklzc3VlQ29tbWVudDQwNDkzMjMxMg==","user":{"login":"zocky","id":142641,"node_id":"MDQ6VXNlcjE0MjY0MQ==","avatar_url":"https://avatars0.githubusercontent.com/u/142641?v=4","gravatar_id":"","url":"https://api.github.com/users/zocky","html_url":"https://github.com/zocky","followers_url":"https://api.github.com/users/zocky/followers","following_url":"https://api.github.com/users/zocky/following{/other_user}","gists_url":"https://api.github.com/users/zocky/gists{/gist_id}","starred_url":"https://api.github.com/users/zocky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zocky/subscriptions","organizations_url":"https://api.github.com/users/zocky/orgs","repos_url":"https://api.github.com/users/zocky/repos","events_url":"https://api.github.com/users/zocky/events{/privacy}","received_events_url":"https://api.github.com/users/zocky/received_events","type":"User","site_admin":false},"created_at":"2018-07-13T19:34:37Z","updated_at":"2018-07-13T19:34:37Z","author_association":"NONE","body":"@littledan \r\n> The disagreement about what the scoping should be in this thread (with multiple interpretations that are considered clearly correct) seems to point to the difficulty of using private.x rather than this.#x.\r\n\r\nActually, this can be very easily clarified, by stating that `private === private(this)`, and then applying the exact same rules for allowing access to `private.foo` as you would for `this.#foo` in the sigil version."}}
{"actor":{"display_login":"zocky"}}