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

Add proxy class that can implement interfaces at runtime. #5641

Closed
justinfagnani opened this issue Oct 4, 2012 · 7 comments
Closed

Add proxy class that can implement interfaces at runtime. #5641

justinfagnani opened this issue Oct 4, 2012 · 7 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 P2 A bug or feature request we're likely to work on type-enhancement A request for a change that isn't a bug

Comments

@justinfagnani
Copy link
Contributor

In unchecked mode it's possible to create objects that implement an interface via noSuchMethod and assign them to a variable or argument of the interface type. This is useful for things like typed proxies for JS interop, automatic stubs for remote/isolated services, etc. In checked mode though assigning to a typed variable causes an exception.

For Proxy, this should work:

var proxy = new Proxy([Foo, Bar]);
assert(proxy is Bar);
assert(proxy is Foo);

Then subclasses can implement behavior.

@gbracha
Copy link
Contributor

gbracha commented Oct 4, 2012

We are aware of this issue and intend to resolve it, as these usage patterns are very important. The specific solution suggested here may or may not be what we end up doing.


Set owner to @gbracha.
Added Accepted label.

@DartBot
Copy link

DartBot commented Aug 21, 2013

This comment was originally written by cvl.c...@gmail.com


Is there any progress on this matter?

I use this pattern a lot in my code. For now I do a workaround and introduce a new class for every proxied class but that's cumbersome.

For me to invest more in the dart language, I need to be sure that this is gonna be implemented somehow at some point in the (near) future.

@floitschG
Copy link
Contributor

Issue #6244 has been merged into this issue.

@justinfagnani
Copy link
Contributor Author

Added C1 label.

@DartBot
Copy link

DartBot commented Jan 2, 2015

This comment was originally written by jirkad...@gmail.com


IMO related:

@justinfagnani justinfagnani added Type-Enhancement area-language Dart language related items (some items might be better tracked at github.com/dart-lang/language). labels Jan 2, 2015
@kevmoo kevmoo removed the accepted label Feb 29, 2016
@pulyaevskiy
Copy link
Contributor

Hey team, just curious, the fact that it's not accepted anymore means this will not be implemented?

I am really interested in solution for this use case.

@kevmoo kevmoo added P2 A bug or feature request we're likely to work on type-enhancement A request for a change that isn't a bug and removed Priority-Medium labels Mar 1, 2016
@floitschG
Copy link
Contributor

@pulyaevskiy:
Sorry for the late response.
As long as the bug is open, it hasn't been rejected. It's not yet high on our TODO lists, and, even when accepted, the outcome might look very different from the proposal here.

TL;DR: we see the need, but we are not currently working on it.

@matanlurey matanlurey added the closed-obsolete Closed as the reported issue is no longer relevant label Jun 19, 2018
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 P2 A bug or feature request we're likely to work on type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

7 participants