{"action":"created","issue":{"url":"https://api.github.com/repos/tc39/proposal-optional-chaining/issues/34","repository_url":"https://api.github.com/repos/tc39/proposal-optional-chaining","labels_url":"https://api.github.com/repos/tc39/proposal-optional-chaining/issues/34/labels{/name}","comments_url":"https://api.github.com/repos/tc39/proposal-optional-chaining/issues/34/comments","events_url":"https://api.github.com/repos/tc39/proposal-optional-chaining/issues/34/events","html_url":"https://github.com/tc39/proposal-optional-chaining/issues/34","id":259910535,"node_id":"MDU6SXNzdWUyNTk5MTA1MzU=","number":34,"title":"Syntax: Use ?& (or anything else that correct the inconsistency between a?.b and a?.[b])","user":{"login":"claudepache","id":3309637,"node_id":"MDQ6VXNlcjMzMDk2Mzc=","avatar_url":"https://avatars2.githubusercontent.com/u/3309637?v=4","gravatar_id":"","url":"https://api.github.com/users/claudepache","html_url":"https://github.com/claudepache","followers_url":"https://api.github.com/users/claudepache/followers","following_url":"https://api.github.com/users/claudepache/following{/other_user}","gists_url":"https://api.github.com/users/claudepache/gists{/gist_id}","starred_url":"https://api.github.com/users/claudepache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/claudepache/subscriptions","organizations_url":"https://api.github.com/users/claudepache/orgs","repos_url":"https://api.github.com/users/claudepache/repos","events_url":"https://api.github.com/users/claudepache/events{/privacy}","received_events_url":"https://api.github.com/users/claudepache/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":281,"created_at":"2017-09-22T19:13:15Z","updated_at":"2018-07-25T15:42:54Z","closed_at":null,"author_association":"COLLABORATOR","body":"After careful consideration (see in particular #5), I think that the best syntax satisfying the difficult constraints we face (strong BC, consistency) is the following:\r\n\r\n```js\r\na ?& . b    // instead of   a ?. b\r\na ?& [ i ]  // instead of   a ?. [ i ]\r\na ?& ( x )  // instead of   a ?. ( x )\r\n```\r\n\r\n### Pros\r\n* Complete consistency between the three syntactical forms.\r\n* Having a `?&` token distinct from `.` is pedagogically better: One can picture the `?&` token checking whether the LHS is null/undefined and performing short-circuiting if applicable, then the subsequent `.`, `[` or `(` token performing regular property access or function invocation.\r\n* Zero conflict/ambiguity in syntax with other features, zero parsing issue.\r\n\r\n### Cons\r\n* Somewhat more awkward to type.\r\n* Different from other languages. (However, it is reminiscent of both `?.` in C#, Swift, CoffeeScript and Groovy, and `&.` in Ruby.)\r\n\r\n### About the choice of ?&\r\n* The `?` recalls that we are dealing with null/undefined, as this character is used in several languages for denoting an optional/nullable value or object.\r\n* The `&` recalls that the short-circuiting condition resemble the one of the `&&` operator (replacing “falsy” with “nullish”).\r\n* The order between those two chars is carefully designed:  `?`: “check for null”; `&`: “perform eventual short-circuiting”."},"comment":{"url":"https://api.github.com/repos/tc39/proposal-optional-chaining/issues/comments/407800170","html_url":"https://github.com/tc39/proposal-optional-chaining/issues/34#issuecomment-407800170","issue_url":"https://api.github.com/repos/tc39/proposal-optional-chaining/issues/34","id":407800170,"node_id":"MDEyOklzc3VlQ29tbWVudDQwNzgwMDE3MA==","user":{"login":"ljharb","id":45469,"node_id":"MDQ6VXNlcjQ1NDY5","avatar_url":"https://avatars1.githubusercontent.com/u/45469?v=4","gravatar_id":"","url":"https://api.github.com/users/ljharb","html_url":"https://github.com/ljharb","followers_url":"https://api.github.com/users/ljharb/followers","following_url":"https://api.github.com/users/ljharb/following{/other_user}","gists_url":"https://api.github.com/users/ljharb/gists{/gist_id}","starred_url":"https://api.github.com/users/ljharb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ljharb/subscriptions","organizations_url":"https://api.github.com/users/ljharb/orgs","repos_url":"https://api.github.com/users/ljharb/repos","events_url":"https://api.github.com/users/ljharb/events{/privacy}","received_events_url":"https://api.github.com/users/ljharb/received_events","type":"User","site_admin":false},"created_at":"2018-07-25T15:42:54Z","updated_at":"2018-07-25T15:42:54Z","author_association":"MEMBER","body":"@lukescott bracket access can never be dropped, no - not just for computed property access, but for Symbols, which can't be done with dot access. Without that symmetry between bracket and dot, the feature makes no sense."}}
{"actor":{"display_login":"ljharb"}}