I would like to start a discussion about adding a new enum data structure to the language.
>From the Rust documentation: enums provide a way to express that a value is one of a possible set of predefined values. I understand that the type system can solve some problems related to this, but I believe a dedicated data structure would be highly useful. For example, I am working on a project that uses Ecto, Absinthe, and Protobuf. Each of these libraries defines its own enum type, which is incompatible with the others. While the Enum namespace is already taken, we could use alternatives like Variant, Choice, or Tag. Having such a data structure defined at the language level would greatly simplify the process of sharing and translating enums across different libraries. This way, all libraries could rely on the same structure. For Ecto, if we wanted to store enums as integers, we could enforce a mapping that raises an error when not all possible values are covered. Examples from other languages include enums in Python <https://docs.python.org/3/library/enum.html> and Rust <https://doc.rust-lang.org/book/ch06-01-defining-an-enum.html>. In many other languages, module-level constants are often used for this purpose. I’d love to hear your thoughts on this! -- You received this message because you are subscribed to the Google Groups "elixir-lang-core" group. To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-core+unsubscr...@googlegroups.com. To view this discussion visit https://groups.google.com/d/msgid/elixir-lang-core/8ae027e9-ca38-4e8a-8c34-bc2e1a48d639n%40googlegroups.com.