dart-lang / dart-lang/language

Unions as parameters

Open
#3,608 13 comments 40 reactions 0 assignees View on GitHub
feature
Dominant language
TeX
Stars
2.9k
Forks
239
Avg merge
2d 18h
Merged PRs (30d)
14

Description

I read https://github.com/dart-lang/language/blob/main/working/union-types/nominative-union-types.md, and see the proposed syntax is something like:
```dart
typedef UrlThingy = Url | String;
Future get(UrlThingy url) async {
...
}
```
Could we just do:
```dart
Future get(Url | String url) async {
...
}
```

Contributor guide

Open the contributing guide

Research direction

Start by reading working/union-types/nominative-union-types.md, which describes the proposed union syntax. Compare the typedef form there with the inline parameter form requested in this issue, then determine whether the language specification should support that syntax and what examples or tests would be needed to establish the decision.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.