Skip to content
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

VM: New typedef doesn't support annotations on parameters #30732

Closed
matanlurey opened this issue Sep 15, 2017 · 2 comments
Closed

VM: New typedef doesn't support annotations on parameters #30732

matanlurey opened this issue Sep 15, 2017 · 2 comments
Labels
area-language Dart language related items (some items might be better tracked at github.com/dart-lang/language). closed-obsolete Closed as the reported issue is no longer relevant

Comments

@matanlurey
Copy link
Contributor

i.e. this is invalid, but it seems to work in other backends:

typedef GatewayClientFactory = Future<GatewayClient> Function(
  WebSocketFactory factory,
  String url, {
  @required RestClient rest,
});
@eernstg
Copy link
Member

eernstg commented Sep 15, 2017

That's an issue with the informal spec. It seems that annotations are meaningful and needed on a normal parameter type as well as a named parameter type? In any case, it would be a surprising exception if named parameters in these Function types support metadata, but other parameters don't.

We've had the old style function typed parameter declaration for a long time with support for metadata (foo(@bar int f(@Baz(14) String s))), so there is no new expressive power here to define (or worry about ;-).

I've created a CL adding this metadata support to the informal spec, to be discussed and possibly accepted by the language team. So getting it implemented in the tools is at least a couple of steps down the road.

@eernstg eernstg added the area-language Dart language related items (some items might be better tracked at github.com/dart-lang/language). label Sep 15, 2017
@matanlurey
Copy link
Contributor Author

No worries, just wanted to double-check. Thanks!

whesse pushed a commit that referenced this issue Sep 18, 2017
In #30732 the concern was raised
that the new Function type syntax does not support metadata on
parameter specifications (i.e., on normalParameterTypes and on
namedParameterTypes).

The implication of adding support for metadata in these locations is
that `@required` can be used on function types, which is the motivation
for submitting 30732.

We have always had support on parameter declarations in function typed
parameter declarations (`void foo(@A() int f(@A() String s))`), so in
this sense there is no new semantics to worry about (Lasse: "it doesn't
mean anything anyway!").

This CL modifies the generic-function-type-alias.md informal spec to
include this kind of metadata support.

Change-Id: I4520d330458242b31c991f62c03ca2f34f9c5e54
Reviewed-on: https://dart-review.googlesource.com/5762
Commit-Queue: Erik Ernst <[email protected]>
Reviewed-by: Bob Nystrom <[email protected]>
Reviewed-by: Lasse R.H. Nielsen <[email protected]>
@matanlurey matanlurey added the closed-obsolete Closed as the reported issue is no longer relevant label Jul 14, 2018
lrhn pushed a commit to dart-lang/language that referenced this issue Sep 4, 2020
In dart-lang/sdk#30732 the concern was raised
that the new Function type syntax does not support metadata on
parameter specifications (i.e., on normalParameterTypes and on
namedParameterTypes).

The implication of adding support for metadata in these locations is
that `@required` can be used on function types, which is the motivation
for submitting 30732.

We have always had support on parameter declarations in function typed
parameter declarations (`void foo(@A() int f(@A() String s))`), so in
this sense there is no new semantics to worry about (Lasse: "it doesn't
mean anything anyway!").

This CL modifies the generic-function-type-alias.md informal spec to
include this kind of metadata support.

Change-Id: I4520d330458242b31c991f62c03ca2f34f9c5e54
Reviewed-on: https://dart-review.googlesource.com/5762
Commit-Queue: Erik Ernst <[email protected]>
Reviewed-by: Bob Nystrom <[email protected]>
Reviewed-by: Lasse R.H. Nielsen <[email protected]>
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-obsolete Closed as the reported issue is no longer relevant
Projects
None yet
Development

No branches or pull requests

2 participants