google / google/xls

[enhancement] DSLX support for option types (like std::optional)

Open
#1,683 3 comments 0 reactions 0 assignees View on GitHub
dslx enhancement 🧦 sox
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

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.