Skip to content

Add a short-hand for redirecting function calls #30116

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
matanlurey opened this issue Jul 8, 2017 · 2 comments
Closed

Add a short-hand for redirecting function calls #30116

matanlurey opened this issue Jul 8, 2017 · 2 comments
Labels
area-language Dart language related items (some items might be better tracked at github.com/dart-lang/language). closed-stale Closed as the issue or PR is assumed stale type-enhancement A request for a change that isn't a bug

Comments

@matanlurey
Copy link
Contributor

matanlurey commented Jul 8, 2017

I ❤️ the fact that factory constructors accept an "=" symbol:

abstract class A {
  factory A({String a}) = _ConcreteA;
}

With the addition of optional new/const, the difference between static functions and factory constructors seems basically to be the ability to say "const" and the ability to be able to use this awesome syntax.

I'd love to be able to use this for all method invocations:

class DelegatingList<T> implements List<T> {
  void add(T item) = super.add;
}

This would also make invoking super in general so nice if allowed:

class B extends A {
  B(arg1, arg2, arg3, arg4, arg5, arg6) = super;
}

Or to use generated functions without writing lots of boilerplate:

part 'foo.g.dart';

foo(arg1, arg2, arg3, arg4) = _$foo;
@lrhn lrhn added area-language Dart language related items (some items might be better tracked at github.com/dart-lang/language). type-enhancement A request for a change that isn't a bug labels Jul 10, 2017
@matanlurey
Copy link
Contributor Author

I still have hope this can happen ❤️

@lrhn lrhn closed this as not planned Won't fix, can't repro, duplicate, stale Apr 9, 2025
@lrhn lrhn added the closed-stale Closed as the issue or PR is assumed stale label Apr 9, 2025
@eernstg
Copy link
Member

eernstg commented Apr 9, 2025

Here is a proposal that substantially overlaps this issue: dart-lang/language#3444.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-language Dart language related items (some items might be better tracked at github.com/dart-lang/language). closed-stale Closed as the issue or PR is assumed stale type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

3 participants