That's because of the order of the definitions of foobar and let.
Thus:

guik.evil=> (macroexpand '(foobar 10))
(let* [a__44__auto__ 10] (clojure.core/+ a__44__auto__ a__44__auto__))

But defining let before foobar:

guik.evil=> (macroexpand-1 '(let))
(guik.evil/let*)
guik.evil=> (macroexpand-1 (macroexpand-1 '(let)))
2
guik.evil=> (macroexpand-1 '(foobar 10))
(guik.evil/let [a__17__auto__ 10] (clojure.core/+ a__17__auto__
a__17__auto__))
guik.evil=> (macroexpand-1 (macroexpand-1 '(foobar 10)))
java.lang.IllegalArgumentException: Wrong number of args (4) passed
to: evil$let (NO_SOURCE_FILE:0)

which is fine since let now takes no args. But this will activate the
local let*:

guik.evil=> (defmacro let [& args] `(guik.evil/let*))
#'guik.evil/let
guik.evil=> (foobar 10)
2

On Apr 10, 6:50 pm, George Rogers <atbusb...@gmail.com> wrote:
> (ns guik.evil)
> ;;1) Special forms cannot be shadowed
> (defmacro let* []
>   (+ 1 1))
> ;; (let*) ; would yield
> ;=> clojure.lang.Compiler$CompilerException:
> java.lang.IllegalArgumentException: Bad binding form, expected vector
> (evil.clj:6)
> ;;2) Shadowing a macro does not change macros that depend on it.
> (defmacro foobar [x]
>   `(let [a# ~x]
>      (+ a# a#)))
> (defmacro let []
>   `(guik.evil/let*))
> (foobar 10) ;=> 20

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