Skip to content

Add Invocation constructors #14776

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
DartBot opened this issue Nov 4, 2013 · 3 comments
Closed

Add Invocation constructors #14776

DartBot opened this issue Nov 4, 2013 · 3 comments
Assignees
Labels
area-language Dart language related items (some items might be better tracked at github.com/dart-lang/language). closed-as-intended Closed as the reported issue is expected behavior

Comments

@DartBot
Copy link

DartBot commented Nov 4, 2013

This issue was originally filed by @seaneagan


From the mailing list:

https://groups.google.com/a/dartlang.org/d/msg/misc/yc57k6TflOQ/UYOeNH-kRU0J

I have a use case for constructing Invocations, but Invocation currently has no constructors.

I could potentially do:

class InvocationMaker {
  noSuchMethod(Invocation invocation) => invocation;
}

var invocation = new InvocationMaker().a(b, c: d);

But that is clearly a hack, and noSuchMethod won't get called for things like == and hashCode that are in Object.

I could also implement Invocation on my own, but will that work when I pass it to InstanceMirror#delegate?

The Invocation constructors could be something like:

  Invocation.getter(Symbol fieldName);
  Invocation.setter(Symbol fieldName, value);
  Invocation.method(
      Symbol methodName,
      {List positionalArguments,
       Map<Symbol, dynamic> namedArguments});

@gbracha
Copy link
Contributor

gbracha commented Nov 4, 2013

This is by design. Analyzing the use of noSuchMethod and mirrors is problematic enough without random instances of Invocation being created.


Set owner to @gbracha.
Added Area-Language, AsDesigned labels.

@DartBot
Copy link
Author

DartBot commented Nov 4, 2013

This comment was originally written by @seaneagan


Why do Invocations merely existing affect mirror and noSuchMethod usage analysis? They are just plain data objects, right? It seems like Invocations are harmless, until they are actually consumed by InstanceMirror#delegate or some other dynamic invocation API.

@DartBot
Copy link
Author

DartBot commented Nov 5, 2013

This comment was originally written by @seaneagan


Some use cases:

* issue #14725

@DartBot DartBot added Type-Defect area-language Dart language related items (some items might be better tracked at github.com/dart-lang/language). closed-as-intended Closed as the reported issue is expected behavior labels Nov 5, 2013
This issue was closed.
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-as-intended Closed as the reported issue is expected behavior
Projects
None yet
Development

No branches or pull requests

3 participants