{"action":"created","issue":{"url":"https://api.github.com/repos/dotnet/roslyn/issues/215","repository_url":"https://api.github.com/repos/dotnet/roslyn","labels_url":"https://api.github.com/repos/dotnet/roslyn/issues/215/labels{/name}","comments_url":"https://api.github.com/repos/dotnet/roslyn/issues/215/comments","events_url":"https://api.github.com/repos/dotnet/roslyn/issues/215/events","html_url":"https://github.com/dotnet/roslyn/issues/215","id":56420910,"number":215,"title":"Proposal: Binary literals","user":{"login":"MadsTorgersen","id":6677272,"avatar_url":"https://avatars.githubusercontent.com/u/6677272?v=3","gravatar_id":"","url":"https://api.github.com/users/MadsTorgersen","html_url":"https://github.com/MadsTorgersen","followers_url":"https://api.github.com/users/MadsTorgersen/followers","following_url":"https://api.github.com/users/MadsTorgersen/following{/other_user}","gists_url":"https://api.github.com/users/MadsTorgersen/gists{/gist_id}","starred_url":"https://api.github.com/users/MadsTorgersen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MadsTorgersen/subscriptions","organizations_url":"https://api.github.com/users/MadsTorgersen/orgs","repos_url":"https://api.github.com/users/MadsTorgersen/repos","events_url":"https://api.github.com/users/MadsTorgersen/events{/privacy}","received_events_url":"https://api.github.com/users/MadsTorgersen/received_events","type":"User","site_admin":false},"labels":[{"id":167974280,"url":"https://api.github.com/repos/dotnet/roslyn/labels/4%20-%20In%20Review","name":"4 - In Review","color":"CCCCCC","default":false},{"id":169838071,"url":"https://api.github.com/repos/dotnet/roslyn/labels/Area-Language%20Design","name":"Area-Language Design","color":"5319e7","default":false},{"id":166677091,"url":"https://api.github.com/repos/dotnet/roslyn/labels/Feature%20Request","name":"Feature Request","color":"fc2929","default":false},{"id":258871715,"url":"https://api.github.com/repos/dotnet/roslyn/labels/Feature%20Specification","name":"Feature Specification","color":"fc2929","default":false},{"id":166377946,"url":"https://api.github.com/repos/dotnet/roslyn/labels/Language-C%23","name":"Language-C#","color":"207de5","default":false},{"id":324461847,"url":"https://api.github.com/repos/dotnet/roslyn/labels/New%20Language%20Feature%20-%20Binary%20Literals","name":"New Language Feature - Binary Literals","color":"bfd4f2","default":false}],"state":"open","locked":false,"assignee":{"login":"MadsTorgersen","id":6677272,"avatar_url":"https://avatars.githubusercontent.com/u/6677272?v=3","gravatar_id":"","url":"https://api.github.com/users/MadsTorgersen","html_url":"https://github.com/MadsTorgersen","followers_url":"https://api.github.com/users/MadsTorgersen/followers","following_url":"https://api.github.com/users/MadsTorgersen/following{/other_user}","gists_url":"https://api.github.com/users/MadsTorgersen/gists{/gist_id}","starred_url":"https://api.github.com/users/MadsTorgersen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MadsTorgersen/subscriptions","organizations_url":"https://api.github.com/users/MadsTorgersen/orgs","repos_url":"https://api.github.com/users/MadsTorgersen/repos","events_url":"https://api.github.com/users/MadsTorgersen/events{/privacy}","received_events_url":"https://api.github.com/users/MadsTorgersen/received_events","type":"User","site_admin":false},"assignees":[{"login":"MadsTorgersen","id":6677272,"avatar_url":"https://avatars.githubusercontent.com/u/6677272?v=3","gravatar_id":"","url":"https://api.github.com/users/MadsTorgersen","html_url":"https://github.com/MadsTorgersen","followers_url":"https://api.github.com/users/MadsTorgersen/followers","following_url":"https://api.github.com/users/MadsTorgersen/following{/other_user}","gists_url":"https://api.github.com/users/MadsTorgersen/gists{/gist_id}","starred_url":"https://api.github.com/users/MadsTorgersen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MadsTorgersen/subscriptions","organizations_url":"https://api.github.com/users/MadsTorgersen/orgs","repos_url":"https://api.github.com/users/MadsTorgersen/repos","events_url":"https://api.github.com/users/MadsTorgersen/events{/privacy}","received_events_url":"https://api.github.com/users/MadsTorgersen/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/dotnet/roslyn/milestones/16","html_url":"https://github.com/dotnet/roslyn/milestones/2.0%20(RTM)","labels_url":"https://api.github.com/repos/dotnet/roslyn/milestones/16/labels","id":1571384,"number":16,"title":"2.0 (RTM)","description":"","creator":{"login":"davkean","id":1103906,"avatar_url":"https://avatars.githubusercontent.com/u/1103906?v=3","gravatar_id":"","url":"https://api.github.com/users/davkean","html_url":"https://github.com/davkean","followers_url":"https://api.github.com/users/davkean/followers","following_url":"https://api.github.com/users/davkean/following{/other_user}","gists_url":"https://api.github.com/users/davkean/gists{/gist_id}","starred_url":"https://api.github.com/users/davkean/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davkean/subscriptions","organizations_url":"https://api.github.com/users/davkean/orgs","repos_url":"https://api.github.com/users/davkean/repos","events_url":"https://api.github.com/users/davkean/events{/privacy}","received_events_url":"https://api.github.com/users/davkean/received_events","type":"User","site_admin":false},"open_issues":573,"closed_issues":142,"state":"open","created_at":"2016-02-08T21:54:04Z","updated_at":"2016-11-23T06:10:01Z","due_on":null,"closed_at":null},"comments":38,"created_at":"2015-02-03T19:01:03Z","updated_at":"2016-11-23T17:06:08Z","closed_at":null,"body":"There’s a relatively common request to add binary literals to C# and VB. For bitmasks (e.g. flag enums) this seems genuinely useful, but it would also be great just for educational purposes.\n\nBinary literals would look like this:\n\n``` c#\nint nineteen = 0b10011;\n```\n\nSyntactically and semantically they are identical to hexadecimal literals, except for using `b`/`B` instead of `x`/`X`, having only digits `0` and `1` and being interpreted in base 2 instead of 16.\n\nThere’s little cost to implementing these, and little conceptual overhead to users of the language.\n# Syntax\n\nThe grammar would be as follows:\n\n> _integer-literal:_\n> &emsp;  ...\n> &emsp;  _binary-integer-literal_\n> \n> _binary-integer-literal:_\n> &emsp;  `0b`  &emsp;  _binary-digits_  &emsp;  _integer-type-suffixopt_\n> &emsp;  `0B`  &emsp;  _binary-digits_  &emsp;  _integer-type-suffixopt_\n> \n> _binary-digits:_\n> &emsp;  _binary-digit_\n> &emsp;  _binary-digits_  &emsp;  _binary-digit_\n> \n> _binary-digit:_  &emsp; one of\n> &emsp;  `0`  `1`\n"},"comment":{"url":"https://api.github.com/repos/dotnet/roslyn/issues/comments/262574205","html_url":"https://github.com/dotnet/roslyn/issues/215#issuecomment-262574205","issue_url":"https://api.github.com/repos/dotnet/roslyn/issues/215","id":262574205,"user":{"login":"wedge905","id":4132514,"avatar_url":"https://avatars.githubusercontent.com/u/4132514?v=3","gravatar_id":"","url":"https://api.github.com/users/wedge905","html_url":"https://github.com/wedge905","followers_url":"https://api.github.com/users/wedge905/followers","following_url":"https://api.github.com/users/wedge905/following{/other_user}","gists_url":"https://api.github.com/users/wedge905/gists{/gist_id}","starred_url":"https://api.github.com/users/wedge905/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wedge905/subscriptions","organizations_url":"https://api.github.com/users/wedge905/orgs","repos_url":"https://api.github.com/users/wedge905/repos","events_url":"https://api.github.com/users/wedge905/events{/privacy}","received_events_url":"https://api.github.com/users/wedge905/received_events","type":"User","site_admin":false},"created_at":"2016-11-23T17:06:08Z","updated_at":"2016-11-23T17:06:08Z","body":"When dealing with hex or binary literals, it's wrong to think of them in terms of numbers.  It's more accurate to think of them in terms of bits and bytes.  They are just arbitrary data, which is meaningless by itself.  The meaning is assigned to the data by the reader.\r\nExample:\r\nWhat number is this?  0b11110100\r\nIf you assume that those bits represent an 8-bit signed int, then it's -12\r\nbut if you assume an 8-bit unsigned int, then it's 244\r\neven if you assume 16-bit signed, then it's still 244\r\n\r\nIt's all in how you read it, which is why @GeirGrusom's answer is the best, because that's exactly what he's doing there, changing how you read the number."}}
{"actor":{"display_login":"wedge905"}}