[enhancement] DSLX support for option types (like std::optional)
- 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)
Until general polymorphism (see #1646) is supported, we don't have a good way to write our own option type. It's also hard to write polymorphic functions that would use such a type (e.g. a `value_or()`).
### Current best alternative workaround (limit 100 words)
Write an option type for each type you want to encapsulate, or just include a `valid` entry in a struct.
### Your view of the "best case XLS enhancement" (limit 100 words)
#618 and #1646 is the ultimate goal. It might be worth:
- using option as a motivating example on the path towards those goals
- building not-general-purpose facilities to support option type before fully supporting polymorphism
Contributor guide
Assessment
This issue has not been assessed yet.