Hi, Am Mittwoch, 11. Dezember 2013 14:27:01 UTC+1 schrieb Mikera: > > You can't really avoid the instance checks: the underlying mechanic is > that the JVM needs to figure out somehow at runtime which overloaded method > version to call, since all it knows at compile time is that it has an > arbitrary Object. > > instance? is the simplest way to do this. There are some fancier ways > (e.g. using reflection or invokedynamic) but your case doesn't have very > complex dispatch requirements so instance? checks are almost certainly the > best option. > > The good news is that instance? checks are extremely fast on the JVM so > performance will still be great (certainly far better than if you used any > kind of reflection....) >
Implementing a clojure protocol will give you fast dispatch on the first argument's type. -billy. -- -- 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.