{"action":"created","issue":{"url":"https://api.github.com/repos/nim-lang/Nim/issues/8425","repository_url":"https://api.github.com/repos/nim-lang/Nim","labels_url":"https://api.github.com/repos/nim-lang/Nim/issues/8425/labels{/name}","comments_url":"https://api.github.com/repos/nim-lang/Nim/issues/8425/comments","events_url":"https://api.github.com/repos/nim-lang/Nim/issues/8425/events","html_url":"https://github.com/nim-lang/Nim/issues/8425","id":344000127,"node_id":"MDU6SXNzdWUzNDQwMDAxMjc=","number":8425,"title":"non ordinal enums are not allowed in set constructor","user":{"login":"enthus1ast","id":13794470,"node_id":"MDQ6VXNlcjEzNzk0NDcw","avatar_url":"https://avatars1.githubusercontent.com/u/13794470?v=4","gravatar_id":"","url":"https://api.github.com/users/enthus1ast","html_url":"https://github.com/enthus1ast","followers_url":"https://api.github.com/users/enthus1ast/followers","following_url":"https://api.github.com/users/enthus1ast/following{/other_user}","gists_url":"https://api.github.com/users/enthus1ast/gists{/gist_id}","starred_url":"https://api.github.com/users/enthus1ast/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/enthus1ast/subscriptions","organizations_url":"https://api.github.com/users/enthus1ast/orgs","repos_url":"https://api.github.com/users/enthus1ast/repos","events_url":"https://api.github.com/users/enthus1ast/events{/privacy}","received_events_url":"https://api.github.com/users/enthus1ast/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-07-24T11:40:47Z","updated_at":"2018-07-24T13:15:07Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"```nim\r\ntype\r\n  AuthenticationMethod* = enum\r\n    NO_AUTHENTICATION_REQUIRED = 0x00.byte\r\n    GSSAPI = 0x01.byte\r\n    USERNAME_PASSWORD = 0x02.byte\r\n    NO_ACCEPTABLE_METHODS = 0xFF.byte\r\n\r\nproc `in`*(bytesMethod: seq[byte], authMethods: set[AuthenticationMethod]): bool =\r\n  for byteMethod in bytesMethod:\r\n    if byteMethod.AuthenticationMethod in authMethods: return true\r\n  return false\r\n  \r\n#fails with Error: ordinal type expected\r\n```"},"comment":{"url":"https://api.github.com/repos/nim-lang/Nim/issues/comments/407402042","html_url":"https://github.com/nim-lang/Nim/issues/8425#issuecomment-407402042","issue_url":"https://api.github.com/repos/nim-lang/Nim/issues/8425","id":407402042,"node_id":"MDEyOklzc3VlQ29tbWVudDQwNzQwMjA0Mg==","user":{"login":"mratsim","id":22738317,"node_id":"MDQ6VXNlcjIyNzM4MzE3","avatar_url":"https://avatars3.githubusercontent.com/u/22738317?v=4","gravatar_id":"","url":"https://api.github.com/users/mratsim","html_url":"https://github.com/mratsim","followers_url":"https://api.github.com/users/mratsim/followers","following_url":"https://api.github.com/users/mratsim/following{/other_user}","gists_url":"https://api.github.com/users/mratsim/gists{/gist_id}","starred_url":"https://api.github.com/users/mratsim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mratsim/subscriptions","organizations_url":"https://api.github.com/users/mratsim/orgs","repos_url":"https://api.github.com/users/mratsim/repos","events_url":"https://api.github.com/users/mratsim/events{/privacy}","received_events_url":"https://api.github.com/users/mratsim/received_events","type":"User","site_admin":false},"created_at":"2018-07-24T13:15:07Z","updated_at":"2018-07-24T13:15:07Z","author_association":"CONTRIBUTOR","body":"A set is a packed bitfield that uses the enum values as index.\r\n\r\nI.e. your set would use bit 0, bit 1, bit 2 and bit 255. But this is not packed anymore since bit: 4...254 are unused.\r\n\r\nThis would prevent iterating over the set as `items` rely on the packed dense representation.\r\n\r\nIn conclusion i think this is not a bug, and it would be a heavy feature to implement see #7699 #8132 #8264 .\r\n\r\nAs a workaround:\r\n  - Fill the holes, see this [macro](https://github.com/status-im/nimbus/blob/473140f58689d03bc0bd8de5f1f65014fe54a557/nimbus/vm/interpreter/utils/macros_gen_opcodes.nim#L25-L83).\r\n  - Or use a HashSet."}}
{"actor":{"display_login":"mratsim"}}