Skip to content

Support Dynamic Proxy #6244

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 Oct 25, 2012 · 4 comments
Closed

Support Dynamic Proxy #6244

DartBot opened this issue Oct 25, 2012 · 4 comments
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. closed-duplicate Closed in favor of an existing report type-enhancement A request for a change that isn't a bug

Comments

@DartBot
Copy link

DartBot commented Oct 25, 2012

This issue was originally filed by @tomyeh


I am looking forward a mechanism similar to Java's dynamic proxy. Without it, it is tedious to intercept a complicated class.

Mixin + implicit class seems possible but the class has to be declared at compile time and there must be a concrete public class available.

@sethladd
Copy link
Contributor

Hi Tom, can you provide a use case for this? What are you trying to do? (Try not to use the words "dynamic proxy" so we can better understand your intent) Thanks!


Removed Type-Defect label.
Added Type-Enhancement, Area-Library, Triaged labels.

@DartBot
Copy link
Author

DartBot commented Oct 28, 2012

This comment was originally written by @tomyeh


Let us say I'd like to extend CSSStyleDeclaration to handle some properties differently. However, there is no implementation available, so I have to implement it from scratch and delegate every method to another except the methods I care:

class Foo implements CSSStyleDeclaration {
   Foo(CSSStyleDeclaration this._css);
   String get animate => _css.animate;
...

But, there are hundreds of methods. It is tedious (and not smart) to do it one by one. (I actually did it by overriding noSuchMethod, but it is right since it ends with non-concrete class)

Let us make the case more complicated. What happens if I'd like to alter some method for a class that we didn't know in compile time? Java dynamic proxy did a great job here. It is worth to have a similar feature.

@DartBot
Copy link
Author

DartBot commented May 16, 2013

This comment was originally written by [email protected]


This issue seems to be the same as #­5641.

@floitschG
Copy link
Contributor

Added Duplicate label.
Marked as being merged into #5641.

@DartBot DartBot added Type-Enhancement area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. closed-duplicate Closed in favor of an existing report labels Nov 4, 2013
@kevmoo kevmoo added type-enhancement A request for a change that isn't a bug and removed type-enhancement labels Mar 1, 2016
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. closed-duplicate Closed in favor of an existing report type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

4 participants