Re: Method overloading by the arity in proxy

2012-10-30 Thread Nikita Beloglazov
Thank you, Meikel. Seem I'll need to move to gen-class instead :(

Nikita

On Tuesday, October 30, 2012 12:41:41 PM UTC+3, Meikel Brandmeyer (kotarak) 
wrote:
>
> Hi,
>
> Am Dienstag, 30. Oktober 2012 08:14:22 UTC+1 schrieb Nikita Beloglazov:
>>
>> Hi. I have a java class that has 2 methods with same but different 
>> arities (one take no arguments, other takes 1 argument). I create a proxy 
>> that overrides both this methods. The problem is that if no-arg method is 
>> called from this java class - base implementation is called instead of 
>> proxie's. Here is an example: https://gist.github.com/3978729. But if I 
>> call no-arg method directly on obj - correct proxy method is invoked. I 
>> can't understand this behavior.
>>
>
> proxy-super temporarily removes the method from the proxy map. So 
> recursive calls see directly the parent method.
>
> Kind regards
> Meikel
>
> Shameless self-promotion: 
> http://kotka.de/blog/2010/03/proxy_gen-class_little_brother.html 
>

-- 
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

Re: Method overloading by the arity in proxy

2012-10-30 Thread Meikel Brandmeyer (kotarak)
Hi,

Am Dienstag, 30. Oktober 2012 08:14:22 UTC+1 schrieb Nikita Beloglazov:
>
> Hi. I have a java class that has 2 methods with same but different arities 
> (one take no arguments, other takes 1 argument). I create a proxy that 
> overrides both this methods. The problem is that if no-arg method is called 
> from this java class - base implementation is called instead of proxie's. 
> Here is an example: https://gist.github.com/3978729. But if I call no-arg 
> method directly on obj - correct proxy method is invoked. I can't 
> understand this behavior.
>

proxy-super temporarily removes the method from the proxy map. So recursive 
calls see directly the parent method.

Kind regards
Meikel

Shameless self-promotion: 
http://kotka.de/blog/2010/03/proxy_gen-class_little_brother.html 

-- 
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

Method overloading by the arity in proxy

2012-10-30 Thread Nikita Beloglazov
Hi. I have a java class that has 2 methods with same but different arities 
(one take no arguments, other takes 1 argument). I create a proxy that 
overrides both this methods. The problem is that if no-arg method is called 
from this java class - base implementation is called instead of proxie's. 
Here is an example: https://gist.github.com/3978729. But if I call no-arg 
method directly on obj - correct proxy method is invoked. I can't 
understand this behavior.

Thank you,
Nikita Beloglazov

-- 
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