Re: Reflective method invocation

2013-06-11 Thread N8Dawgrr
Thanks for the responses Ambrose and Gary, I suppose the answer is its dependent on JVM implementation/version. As Gary pointed out his code broke on the JVM upgrade. The real question is, if there is ambiguity what "should" the behaviour be? It seems far from ideal atm, brodering on non-determ

Re: Reflective method invocation

2013-06-11 Thread Gary Trakhman
The result can be JVM-dependent. I've solved a bug in our codebase that was due to JDK 7's reflection preferring a different constructor for an object than 6, which was fixed by explicitly wrapping the ambiguous argument in (boolean). Whatever the behavior, it's best to not rely on a specific bro

Re: Reflective method invocation

2013-06-11 Thread Ambrose Bonnaire-Sergeant
Hi Nathan, I just had a quick look at the implementation: I think Clojure picks the first matching method if several are found. https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Reflector.java#L70 It's probably worth testing this out though. Thanks, Ambrose On Tue, Jun 11, 2

Reflective method invocation

2013-06-11 Thread N8Dawgrr
Hi All, I have a question regarding ambiguity in reflective dynamic invocation. In Clojure you can dynamically invoke a method on a Java class like so: (. some-instance bar arg) where bar is a method name. If the type inferencer can't ascertain the type of some-instance a runtime reflective p