xls
xls copied to clipboard
[enhancement] Auto-numbering enums
What's hard to do? (limit 100 words)
I wager most enums go from 0 - N, so it'd be nice if we could write:
enum Foo : u8 {
A, B, C, D,
}
Current best alternative workaround (limit 100 words)
enum Foo : u8 {
A = 0,
B = 1,
C = 2,
D = 3,
}
Your view of the "best case XLS enhancement" (limit 100 words)
An even cooler bonus would be to allow for different auto-numbering ranges, e.g.,
enum Foo : u8 {
A = 0, B, C,
F = 100, G, H,
}
the above would be equivalent to:
enum Foo : u8 {
A = 0,
B = 1,
C = 2,
F = 100,
G = 101,
H = 102
}
For reference, rust's take on this is: https://doc.rust-lang.org/reference/items/enumerations.html#implicit-discriminants