dart-lang / dart-lang/language

Lowering the requirements for default const parameters

Open
#429 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
TeX
Stars
2.9k
Forks
239
Avg merge
2d 18h
Merged PRs (30d)
14

Description

Documentation says that

> The default values must be compile-time constants

I'm curious why `const` values are required. I think it would be better if this requirement will be lowering a bit. It'll be awesome to be able to use **previous passed arguments** as default parameters or every time create a new **modifiable** default list in place of using `const` one:
```dart
void read(byte[] bytes, {int offset = 0, int length = bytes.size, byte[] avoid = []}) {
...
}
```

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.