google / google/xls

[enhancement] Auto-numbering enums

Open
#3,256 1 comment 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
C++
Stars
1.9k
Forks
283
Avg merge
2d 10h
Merged PRs (30d)
135

Description

### 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
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.