{"action":"created","issue":{"url":"https://api.github.com/repos/dart-lang/sdk/issues/27396","repository_url":"https://api.github.com/repos/dart-lang/sdk","labels_url":"https://api.github.com/repos/dart-lang/sdk/issues/27396/labels{/name}","comments_url":"https://api.github.com/repos/dart-lang/sdk/issues/27396/comments","events_url":"https://api.github.com/repos/dart-lang/sdk/issues/27396/events","html_url":"https://github.com/dart-lang/sdk/issues/27396","id":177999341,"number":27396,"title":"Can't do bit-wise operations on Booleans.","user":{"login":"indiealexh","id":1066212,"avatar_url":"https://avatars.githubusercontent.com/u/1066212?v=3","gravatar_id":"","url":"https://api.github.com/users/indiealexh","html_url":"https://github.com/indiealexh","followers_url":"https://api.github.com/users/indiealexh/followers","following_url":"https://api.github.com/users/indiealexh/following{/other_user}","gists_url":"https://api.github.com/users/indiealexh/gists{/gist_id}","starred_url":"https://api.github.com/users/indiealexh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/indiealexh/subscriptions","organizations_url":"https://api.github.com/users/indiealexh/orgs","repos_url":"https://api.github.com/users/indiealexh/repos","events_url":"https://api.github.com/users/indiealexh/events{/privacy}","received_events_url":"https://api.github.com/users/indiealexh/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/dart-lang/sdk/labels/area-library","name":"area-library","color":"c7def8"},{"url":"https://api.github.com/repos/dart-lang/sdk/labels/library-core","name":"library-core","color":"d4c5f9"},{"url":"https://api.github.com/repos/dart-lang/sdk/labels/Resolution:%20duplicate","name":"Resolution: duplicate","color":"8d8d8d"}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-09-20T08:37:31Z","updated_at":"2016-09-20T09:26:58Z","closed_at":"2016-09-20T09:26:57Z","body":"Take the following code:\r\n```Dart\r\nbool val1 = true;\r\nbool val2 = false;\r\nbool result = val1 ^ val2;\r\n```\r\n\r\nThe above quite logical code would throw: \r\n\r\n> Unhandled exception:\r\n> Class 'bool' has no instance method '^'.\r\n\r\nAs a result to be able to xor booleans together I have to do the following:\r\n\r\n```dart\r\nmain() {\r\n  bool val1 = true;\r\n  bool val2 = false;\r\n  bool result = xorBool(val1,val2);\r\n}\r\n\r\nbool xorBool(bool item1, bool item2) {\r\n  var xorValue = (item1?1:0) ^ (item2?1:0);\r\n  return (xorValue==1?true:false);\r\n}\r\n```\r\n\r\nThis seems seriously in error considering in JavaScript, Java, C# etc I can directly do bit-wise operations against a Boolean value.\r\n\r\nOr as someone else pointed out `(val1 != val2)`"},"comment":{"url":"https://api.github.com/repos/dart-lang/sdk/issues/comments/248250398","html_url":"https://github.com/dart-lang/sdk/issues/27396#issuecomment-248250398","issue_url":"https://api.github.com/repos/dart-lang/sdk/issues/27396","id":248250398,"user":{"login":"lrhn","id":4865287,"avatar_url":"https://avatars.githubusercontent.com/u/4865287?v=3","gravatar_id":"","url":"https://api.github.com/users/lrhn","html_url":"https://github.com/lrhn","followers_url":"https://api.github.com/users/lrhn/followers","following_url":"https://api.github.com/users/lrhn/following{/other_user}","gists_url":"https://api.github.com/users/lrhn/gists{/gist_id}","starred_url":"https://api.github.com/users/lrhn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lrhn/subscriptions","organizations_url":"https://api.github.com/users/lrhn/orgs","repos_url":"https://api.github.com/users/lrhn/repos","events_url":"https://api.github.com/users/lrhn/events{/privacy}","received_events_url":"https://api.github.com/users/lrhn/received_events","type":"User","site_admin":false},"created_at":"2016-09-20T09:26:57Z","updated_at":"2016-09-20T09:26:57Z","body":"The original request was #1080. The reasoning was that it could be confusing to have `&` do one thing on integers and another on bools."}}
{"actor":{"display_login":"lrhn"}}