>> But my problem is that why clojure compiler could not use the body form as 
>> the :inline value automatically for us instead of writing a duplicate form? 
>> I think below codes is more suitable:

It's not a duplicate form. Sure it may appear to be to those of us
with organic brains that excel at pattern matching, but one is a
macro, the other is a function.

>From a compiler viewpoint the logic is very simple:

1) if you're using pos? as a function (e.g. (map pos? [1 2 3]) ).
Compile the function body.
2) if we're calling pos? directly, consider the :inline call to be a
macro, and use the expansion of the macro instead of the function
call.

True, the compiler could figure this all out, but that's more logic in
the (already complex compiler) that has to be written, maintained,
etc. And the truth is, inline is used so rarely, that it doesn't make
sense to add all this complexity to the compiler. Also remember, the
JVM will inline function calls as well, so that makes the uses of this
even more rare.

Timothy

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