dart-lang / dart-lang/language

Named functions

Open
#322 3 comments 0 reactions 0 assignees View on GitHub
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

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.