> Well, the statement you just made is true, but nonetheless you are the 
> one who is mistaken. The emit() method is called, but if not enough 
> information was present at compile time to resolve to a real method 
> call (that is, if `method = null` was executed), then the emit() code 
> emits a call to clojure.lang.Reflector/invokeMatchingMethod, which 
> does runtime reflection. See 
>
> https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Compiler.java#L1426
>  
> where the "fast path" code is only emitted if `method != null`, and 
>
> https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Compiler.java#L1446
>  
> where the slow code is emitted instead. 
>

See here:

https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Compiler.java#L1366

You will get a warning that the slow path will be used, so you will have a 
chance to add hinting to your code. In my opinion, it's a reasonable 
workaround.

Still... your comment makes me think that are especially dynamic use cases 
where you really don't want hinting, but you do want the correct method to 
be called (which is why this is a warning and not an error, I guess). But... 
wouldn't solving this in Lisp be easier?

I commented somewhere else that Lisp differs from other languages in that a 
lot of optimization is often the programmer's job. Memoization, smart 
recursion techniques, etc., can't be left to the underlying engine. 
Sometimes this is good! Programmer knows best. :)

-Tal
 

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

Reply via email to