{"action":"created","issue":{"url":"https://api.github.com/repos/tc39/proposal-class-fields/issues/111","repository_url":"https://api.github.com/repos/tc39/proposal-class-fields","labels_url":"https://api.github.com/repos/tc39/proposal-class-fields/issues/111/labels{/name}","comments_url":"https://api.github.com/repos/tc39/proposal-class-fields/issues/111/comments","events_url":"https://api.github.com/repos/tc39/proposal-class-fields/issues/111/events","html_url":"https://github.com/tc39/proposal-class-fields/issues/111","id":339909534,"node_id":"MDU6SXNzdWUzMzk5MDk1MzQ=","number":111,"title":"Nested classes create inconsistent access paradigms","user":{"login":"bdistin","id":18535830,"node_id":"MDQ6VXNlcjE4NTM1ODMw","avatar_url":"https://avatars2.githubusercontent.com/u/18535830?v=4","gravatar_id":"","url":"https://api.github.com/users/bdistin","html_url":"https://github.com/bdistin","followers_url":"https://api.github.com/users/bdistin/followers","following_url":"https://api.github.com/users/bdistin/following{/other_user}","gists_url":"https://api.github.com/users/bdistin/gists{/gist_id}","starred_url":"https://api.github.com/users/bdistin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bdistin/subscriptions","organizations_url":"https://api.github.com/users/bdistin/orgs","repos_url":"https://api.github.com/users/bdistin/repos","events_url":"https://api.github.com/users/bdistin/events{/privacy}","received_events_url":"https://api.github.com/users/bdistin/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":44,"created_at":"2018-07-10T16:05:42Z","updated_at":"2018-07-13T19:35:20Z","closed_at":null,"author_association":"NONE","body":"![img](https://camo.githubusercontent.com/fb8b6bafb0cdbe78faf0368deac5d160cdc53d30/68747470733a2f2f7075752e73682f4154506a4d2f366561633439663963322e706e67)\r\n\r\nThe above is tested in V8's implementation of this proposal. While both are true according to spec, only one should be true according to the requirements laid out in the [FAQ](https://github.com/tc39/proposal-class-fields/blob/master/PRIVATE_SYNTAX_FAQ.md)\r\n\r\nNamely:\r\n\r\n>1. It is a goal of this proposal to allow accessing private fields of other instances of the __same class__.\r\n>2. It (Hard-Private/Encapsulation) means that private fields are purely internal: __no JS code__ outside of a class __can detect or affect the existence, name, or value of any private field of instances of said class__\r\n\r\nSo let's break that down:\r\n\r\n~~On the left, we have private fields being accessed in a class that is __not the same__ as the class the code is being run from. It is my personal opinion that is a breach of Hard-Private/Encapsulation, and the left example code should be considered incorrect. However, as that is an opinion, I am open to the idea \"What if the left code results are correct?\"~~\r\n\r\nOn the right, we have the result I would have expected given a strict **same class** definition of Hard-Private/Encapsulation. But in the context that the left is correct, we get an equally unexpected result.\r\n1. Given 2 public fields, __you can access both inner and outer public fields__, given the `this` (context): ![img](https://camo.githubusercontent.com/70a4abcebb11801906b6e665061a8141e4074c86/68747470733a2f2f7075752e73682f41553051382f303239613963326362622e706e67)\r\n2. Given 2 private fields and providing instances of the inner class and outer class as `this`, as shown in the top image right, __you can only access the inner private field__.\r\n3. Given 1 outer private field and an instance of the outer class, as shown in the top image left, __the outer private field is accessible__.\r\n\r\nAssuming access to the outer private field is given to an inner class, it would be expected to be able to access both the inner and outer private field, just as we can access as public fields. The `this` syntax implies that `#a` (a private a field) should be just as relative to the `this` of the function call, as `a` (a public a field). As it stands, declaring a private field shadowing an outer private field affects the accessibility of the outer private field.\r\n\r\nThis issue arose in the conversation here: https://github.com/tc39/proposal-private-methods/issues/28\r\n\r\n**Edit:** I concede that the left-hand side should be considered correct.  I also understand why the result of the right-hand side is how it is. But I think the right-hand side still is not ideal/greatly breaks consistency and expectations setup by public fields."},"comment":{"url":"https://api.github.com/repos/tc39/proposal-class-fields/issues/comments/404932470","html_url":"https://github.com/tc39/proposal-class-fields/issues/111#issuecomment-404932470","issue_url":"https://api.github.com/repos/tc39/proposal-class-fields/issues/111","id":404932470,"node_id":"MDEyOklzc3VlQ29tbWVudDQwNDkzMjQ3MA==","user":{"login":"mmis1000","id":2993977,"node_id":"MDQ6VXNlcjI5OTM5Nzc=","avatar_url":"https://avatars3.githubusercontent.com/u/2993977?v=4","gravatar_id":"","url":"https://api.github.com/users/mmis1000","html_url":"https://github.com/mmis1000","followers_url":"https://api.github.com/users/mmis1000/followers","following_url":"https://api.github.com/users/mmis1000/following{/other_user}","gists_url":"https://api.github.com/users/mmis1000/gists{/gist_id}","starred_url":"https://api.github.com/users/mmis1000/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mmis1000/subscriptions","organizations_url":"https://api.github.com/users/mmis1000/orgs","repos_url":"https://api.github.com/users/mmis1000/repos","events_url":"https://api.github.com/users/mmis1000/events{/privacy}","received_events_url":"https://api.github.com/users/mmis1000/received_events","type":"User","site_admin":false},"created_at":"2018-07-13T19:35:20Z","updated_at":"2018-07-13T19:35:20Z","author_association":"NONE","body":"@bdistin the proposal proposed by @zocky  actully disallow Destructure, I though the chart you create needs a little rewrote? \r\nThe point 5 said that https://github.com/tc39/proposal-private-methods/issues/28#issue-306250831"}}
{"actor":{"display_login":"mmis1000"}}