The evaluation of meta data happens when the def form is evaluated: user=> (meta (second (read-string "(def ^{:key (+ 1 1)} foo)"))) {:key (+ 1 1)}
vis a vis user=> (meta (eval (read-string "(def ^{:key (+ 1 1)} foo)"))) {:ns #<Namespace user>, :name foo, :file "NO_SOURCE_PATH", :line 1, :key 2} The reader doesn't interact with the runtime, except for resolving the current namespace in backtick `forms and and for reader tags and related mechanisms. A little experiment in clojure 1.5.1 showed, that during AOT compilation, the meta data gets evaluated twice, but it is still evaluated when require'ing the resulting class files. 2013/3/19 Angel Java Lopez <ajlopez2...@gmail.com> > Thanks Jean! > > Yes, I did that test before my email. > > But my doubt is: > > What part is in charge of metadata evaluation? > > From such test, I can't deduce if the metadata evaluation is made by the > reader, or by the macro def. > > If the metadata evaluation is made by the reader, the symbol two will have > {:a 2} as metadata, and then, the macro def get the metadata from the > symbol and assign the var the def macro is defining. > > But the online docs maybe describe other way: > > "Any metadata on the symbol will be evaluated, and become metadata on the > var itself." > > That is, the metadata ALREADY in symbol, is then EVALUATED by def special > form. > > My context: I'm writing an interpreter of Clojure, in C#, to practice TDD, > with behavior based on published doc, or core.clj, I'm not sure what is the > expected behavior of the reader, metadata and special form. > > Maybe, the two options I described in my first email, are EQUIVALENT for > all practical purpose, but I have the doubt, and I don't know how to write > a clojure code that helps me to discover the current behavior > > Angel "Java" Lopez > @ajlopez > > On Tue, Mar 19, 2013 at 7:35 AM, Jean Niklas L'orange < > jeann...@hypirion.com> wrote: > >> >> >> On Tuesday, March 19, 2013 9:49:09 AM UTC+1, ajlopez wrote: >>> >>> Hi everyone! >> >> >> Hi! >> >> The easiest thing to find out of this would be to check it out: >> >> (def ^{:a (+ 1 1)} two 2) >> ;=> user/two >> (meta #'two) >> ;=> {.... :a 2} >> >> So indeed, the forms within metadata is evaluated. >> >> -- Jean Niklas L'orange >> >> -- >> -- >> 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. >> >> >> > > -- > -- > 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. > > > -- -- 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.