{"action":"created","issue":{"url":"https://api.github.com/repos/ark-lang/ark/issues/642","labels_url":"https://api.github.com/repos/ark-lang/ark/issues/642/labels{/name}","comments_url":"https://api.github.com/repos/ark-lang/ark/issues/642/comments","events_url":"https://api.github.com/repos/ark-lang/ark/issues/642/events","html_url":"https://github.com/ark-lang/ark/pull/642","id":128009990,"number":642,"title":"Add binary comparator for non-simple enums","user":{"login":"Acconut","id":1375043,"avatar_url":"https://avatars.githubusercontent.com/u/1375043?v=3","gravatar_id":"","url":"https://api.github.com/users/Acconut","html_url":"https://github.com/Acconut","followers_url":"https://api.github.com/users/Acconut/followers","following_url":"https://api.github.com/users/Acconut/following{/other_user}","gists_url":"https://api.github.com/users/Acconut/gists{/gist_id}","starred_url":"https://api.github.com/users/Acconut/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Acconut/subscriptions","organizations_url":"https://api.github.com/users/Acconut/orgs","repos_url":"https://api.github.com/users/Acconut/repos","events_url":"https://api.github.com/users/Acconut/events{/privacy}","received_events_url":"https://api.github.com/users/Acconut/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2016-01-21T20:14:53Z","updated_at":"2016-01-21T20:58:23Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/ark-lang/ark/pulls/642","html_url":"https://github.com/ark-lang/ark/pull/642","diff_url":"https://github.com/ark-lang/ark/pull/642.diff","patch_url":"https://github.com/ark-lang/ark/pull/642.patch"},"body":"This change implements the `==` and `!=` operators for non-simple enums which may have an additional tuple or struct value. Previously the `enum_comp` test case would fail:\r\n\r\n```\r\nerror: [enum-comp:7:9] Operands for binary operator `==` must be numeric, or pointers or booleans, have `Entry`\r\n  print(n == Entry::None);\r\n```\r\n\r\nAt the moment, only the tag is compared and not the optional content of the enum:\r\n```\r\nEntry::Value(1) == Entry::Value(2) // true;\r\n```\r\nHowever, there are cases in which this behaviour is wanted.\r\n"},"comment":{"url":"https://api.github.com/repos/ark-lang/ark/issues/comments/173705751","html_url":"https://github.com/ark-lang/ark/pull/642#issuecomment-173705751","issue_url":"https://api.github.com/repos/ark-lang/ark/issues/642","id":173705751,"user":{"login":"felixangell","id":6254332,"avatar_url":"https://avatars.githubusercontent.com/u/6254332?v=3","gravatar_id":"","url":"https://api.github.com/users/felixangell","html_url":"https://github.com/felixangell","followers_url":"https://api.github.com/users/felixangell/followers","following_url":"https://api.github.com/users/felixangell/following{/other_user}","gists_url":"https://api.github.com/users/felixangell/gists{/gist_id}","starred_url":"https://api.github.com/users/felixangell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/felixangell/subscriptions","organizations_url":"https://api.github.com/users/felixangell/orgs","repos_url":"https://api.github.com/users/felixangell/repos","events_url":"https://api.github.com/users/felixangell/events{/privacy}","received_events_url":"https://api.github.com/users/felixangell/received_events","type":"User","site_admin":false},"created_at":"2016-01-21T20:58:23Z","updated_at":"2016-01-21T20:58:23Z","body":"We could possibly give something an attribute so that the behaviour of doing `==` checks for partial equality on a tagged union?. I quite like the `~=` operator, but I prefer not to introduce operators for things (personally) or in other words, an operator for this would be a last resort type thing. The only downside is that whenever you check equality it will always resort to this behaviour. Another thing is to compare the discriminant of the variant, so we could have a function or some kind of operator like `len()` and you can use those to compare the variants by their values?"}}