That's exactly what you should do and it does work, e.g.:

user=> (set! *warn-on-reflection* true)
true
user=> (.meta ^clojure.lang.IMeta (proxy [clojure.lang.IMeta] [] (meta [] {:a 
1})))
{:a 1}

In your small example you have two errors that might be fishy: a missing arg 
vector to pass to the super ctor and an extra `this` parameter in the method 
impl (proxy, unlike reify, is anaphoric and binds `this` for you)


> On 30 Jul 2018, at 10:56, Mark Engelberg <mark.engelb...@gmail.com> wrote:
> 
> Let's say I have a proxy object:
> 
> (def p (proxy [MyClass MyInterface] (interfaceMethod [this] ...)))
> 
> Now, I want to call (.interfaceMethod p).  How do I do this without 
> reflection?
> I would have thought that (.interfaceMethod ^MyInterface p) would work, but 
> this results in an error message that this proxy object cannot be cast to 
> MyInterface.
> 
> 
> 
> -- 
> 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 
> <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 
> <mailto:clojure+unsubscr...@googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.

-- 
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/d/optout.

Reply via email to