Hi,

On Mon, May 31, 2010 at 10:21:14AM -0700, Quzanti wrote:

> Are you sure that always works?
> 
> I think I am misunderstanding Halloway's Taxonomy of Macro's chapter
> 
> defstruct is written as a macro and Stuart then comments
> 
> "This macro looks so simple that you may be tempted to try to write it
> as a function. You won't be able to because def is a special form. You
> must generate def at macro time; you cannot make 'dynamic' calls to
> def at runtime"

It works sometimes. Of course you can redef a Var via function.

(defn foo [y] (def x y))
(foo 5)

However, you cannot define arbitrary Vars.

(defn bar [x y] (def x y))
(bar 'c 5)

This does *not* define Var named c. So can't really make 'dynamic'
calls to def at runtime. Just as Stuart writes.

Sincerely
Meikel

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