Auto-generate MyEnumType.all() method that returns an array of all values of type MyEnumType #11646
elimisteve
started this conversation in
Ideas
Replies: 1 comment
-
Iterator over enum values is already possible, see https://github.com/vlang/v/blob/master/doc/docs.md#values |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I would like to be able to do something like this:
Then we also wouldn't have to have things like we see in
vlib/compiler/main.v
, as one example --but could instead simply do
if a
str()
method is also created for eachenum
type that returns the name of the value.This was suggested in the docs, too, and is a great idea:
Beta Was this translation helpful? Give feedback.
All reactions