Hi,

Am Montag, 15. April 2013 20:57:30 UTC+2 schrieb Jim foo.bar:
>
>  Hi everyone,
>
> I was very surprised to find out that it is practically impossible to 
> subclass some Class Foo and override only 1 overload of some method bar() 
> via proxy...especially, if there are more than 1 methods 'bar' taking args 
> like below, where InterfaceY extends InterfaceX. Providing the types does 
> nothing - it seems proxy only cares about arity....
>
> void bar(InterfaceX ix); //*not *supposed to be overriden
>
> abstract void bar(InterfaceY iy); //but this is indeed supposed to be 
> overriden
>
>
Does this work?

(proxy [YourClass BarInterface] []
  (bar [x-or-y]
    (if (instance? InterfaceY x-or-y)
      (override x-or-y)
      (proxy-super x-or-y))))

Their might be cases where this works. And where it doesn't. Eg. when the 
X-bar calls the Y-bar.

Meikel

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to