{"action":"created","issue":{"url":"https://api.github.com/repos/golang/go/issues/28493","repository_url":"https://api.github.com/repos/golang/go","labels_url":"https://api.github.com/repos/golang/go/issues/28493/labels{/name}","comments_url":"https://api.github.com/repos/golang/go/issues/28493/comments","events_url":"https://api.github.com/repos/golang/go/issues/28493/events","html_url":"https://github.com/golang/go/issues/28493","id":375717960,"node_id":"MDU6SXNzdWUzNzU3MTc5NjA=","number":28493,"title":"proposal: permit blank (_) separator in integer number literals","user":{"login":"griesemer","id":8528975,"node_id":"MDQ6VXNlcjg1Mjg5NzU=","avatar_url":"https://avatars2.githubusercontent.com/u/8528975?v=4","gravatar_id":"","url":"https://api.github.com/users/griesemer","html_url":"https://github.com/griesemer","followers_url":"https://api.github.com/users/griesemer/followers","following_url":"https://api.github.com/users/griesemer/following{/other_user}","gists_url":"https://api.github.com/users/griesemer/gists{/gist_id}","starred_url":"https://api.github.com/users/griesemer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/griesemer/subscriptions","organizations_url":"https://api.github.com/users/griesemer/orgs","repos_url":"https://api.github.com/users/griesemer/repos","events_url":"https://api.github.com/users/griesemer/events{/privacy}","received_events_url":"https://api.github.com/users/griesemer/received_events","type":"User","site_admin":false},"labels":[{"id":150880249,"node_id":"MDU6TGFiZWwxNTA4ODAyNDk=","url":"https://api.github.com/repos/golang/go/labels/Go2","name":"Go2","color":"ffaaaa","default":false},{"id":236419512,"node_id":"MDU6TGFiZWwyMzY0MTk1MTI=","url":"https://api.github.com/repos/golang/go/labels/Proposal","name":"Proposal","color":"ededed","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/golang/go/milestones/30","html_url":"https://github.com/golang/go/milestone/30","labels_url":"https://api.github.com/repos/golang/go/milestones/30/labels","id":1373555,"node_id":"MDk6TWlsZXN0b25lMTM3MzU1NQ==","number":30,"title":"Proposal","description":"Proposals that are pending (not yet accepted/rejected).\r\n","creator":{"login":"rsc","id":104030,"node_id":"MDQ6VXNlcjEwNDAzMA==","avatar_url":"https://avatars1.githubusercontent.com/u/104030?v=4","gravatar_id":"","url":"https://api.github.com/users/rsc","html_url":"https://github.com/rsc","followers_url":"https://api.github.com/users/rsc/followers","following_url":"https://api.github.com/users/rsc/following{/other_user}","gists_url":"https://api.github.com/users/rsc/gists{/gist_id}","starred_url":"https://api.github.com/users/rsc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rsc/subscriptions","organizations_url":"https://api.github.com/users/rsc/orgs","repos_url":"https://api.github.com/users/rsc/repos","events_url":"https://api.github.com/users/rsc/events{/privacy}","received_events_url":"https://api.github.com/users/rsc/received_events","type":"User","site_admin":false},"open_issues":229,"closed_issues":678,"state":"open","created_at":"2015-10-24T01:40:49Z","updated_at":"2018-11-05T15:22:19Z","due_on":null,"closed_at":null},"comments":26,"created_at":"2018-10-30T22:21:32Z","updated_at":"2018-11-05T17:49:44Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"This has come up before, specifically during discussions of #19308 and #28256. I am writing this down so we have a place for discussing this independently. I have no strong feelings about this proposal either way.\r\n\r\n#### Proposal\r\n\r\nThis is a fully backward-compatible proposal for permitting the use of a blank (\\_) as a separator in number literals. Specifically, we change the integer literal syntax such that we also allow a \"\\_\" after the first digit (the change is the extra \"\\_\"):\r\n\r\n> int_lit     = decimal_lit | octal_lit | hex_lit .\r\n> decimal_lit = ( \"1\" … \"9\" ) { decimal_digit | \"\\_\" } .\r\n> octal_lit   = \"0\" { octal_digit | \"\\_\" } .\r\n> hex_lit     = \"0\" ( \"x\" | \"X\" ) hex_digit { hex_digit | \"\\_\" } .\r\n\r\nAnd we change the floating-point number literal syntax correspondingly (the change is the extra \"\\_\"):\r\n\r\n> float_lit = decimals \".\" [ decimals ] [ exponent ] | decimals exponent | \".\" decimals [ exponent ] .\r\n> decimals  = decimal_digit { decimal_digit | \"\\_\" } .\r\n> exponent  = ( \"e\" | \"E\" ) [ \"+\" | \"-\" ] decimals .\r\n\r\nFor complex number literals the change is implied by the change to floating-point literals.\r\n\r\nExamples:\r\n\r\n```\r\n123_456_789\r\n1_000_000_000\r\n0b0110_1101_1101_0010  // if we had binary integer literals\r\n0xdead_beef\r\n3.1415_9265\r\n```\r\n\r\nbut also:\r\n\r\n```\r\n0___         // 0\r\n0_77         // 77 decimal, or perhaps not permitted (TBD)\r\n01_10        // 0110 (octal)\r\n1_2__3___    // 123\r\n0x1_23_0     // 0x1230\r\n0__.0__e-0__ // 0.0e-0\r\n```\r\n\r\n#### Discussion\r\n\r\nThe notation follows more or less the syntax used in other languages (e.g., [Swift](https://docs.swift.org/swift-book/ReferenceManual/LexicalStructure.html#gLiterals)).\r\nThe implementation is straight-forward (a minor change to the number scanner). As the examples show, the separator, if judiciously used, may improve readability; or it may degrade it significantly.\r\nA tool (go vet) might impose restrictions on how the separator is used for readability."},"comment":{"url":"https://api.github.com/repos/golang/go/issues/comments/435968898","html_url":"https://github.com/golang/go/issues/28493#issuecomment-435968898","issue_url":"https://api.github.com/repos/golang/go/issues/28493","id":435968898,"node_id":"MDEyOklzc3VlQ29tbWVudDQzNTk2ODg5OA==","user":{"login":"griesemer","id":8528975,"node_id":"MDQ6VXNlcjg1Mjg5NzU=","avatar_url":"https://avatars2.githubusercontent.com/u/8528975?v=4","gravatar_id":"","url":"https://api.github.com/users/griesemer","html_url":"https://github.com/griesemer","followers_url":"https://api.github.com/users/griesemer/followers","following_url":"https://api.github.com/users/griesemer/following{/other_user}","gists_url":"https://api.github.com/users/griesemer/gists{/gist_id}","starred_url":"https://api.github.com/users/griesemer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/griesemer/subscriptions","organizations_url":"https://api.github.com/users/griesemer/orgs","repos_url":"https://api.github.com/users/griesemer/repos","events_url":"https://api.github.com/users/griesemer/events{/privacy}","received_events_url":"https://api.github.com/users/griesemer/received_events","type":"User","site_admin":false},"created_at":"2018-11-05T17:49:44Z","updated_at":"2018-11-05T17:49:44Z","author_association":"CONTRIBUTOR","body":"Here's related Python PEP 515 (Underscores in Numeric Literals) with their proposed syntax plus a discussion of pros/cons: https://www.python.org/dev/peps/pep-0515/ ."}}
{"actor":{"display_login":"griesemer"}}