dart-lang / dart-lang/language
Named functions
Open
- Dominant language
- TeX
- Stars
- 2.9k
- Forks
- 239
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 14
Description
A potential solution to methods overload https://github.com/dart-lang/sdk/issues/26488
The idea to allow functions to behave similarly to constructors:
```dart
void foo() {}
int foo.named(int arg) => arg;
void foo._privateNamed() {}
```
____
This feature would probably be syntax sugar over callable classes. Using callable classes, our previous example is:
```dart
class _Foo {
const _Foo();
void call() {};
int named(int arg) => arg;
void _privateNamed() {}
}
const foo = _Foo();
```
Contributor guide
Assessment
This issue has not been assessed yet.