Christophe,

Thank you for your research and for opening the ticket.

Jim

On Thu, May 27, 2010 at 9:59 AM, Christophe Grand <christo...@cgrand.net> wrote:
> Hi,
>
> On Thu, May 27, 2010 at 3:28 PM, Jim Menard <jim.men...@gmail.com> wrote:
>>
>> I've given some functions metadata that I want to use elsewhere. My
>> problem is, I don't see the metadata I've added if I use or require
>> the namespace; I need to explicitly load the file (or eval the
>> function definitions manually in slime/swank) to see the metatada.
>> Here's some simple code that shows my problem. What am I doing wrong,
>> or not understanding about metadata?
>>
>> ;;; ================ src/ctest/funcs.clj ================
>> (ns ctest.funcs)
>>
>> (defn
>>  #^{:wadl {:url "/f1" :method "GET" :doc "The f1 function."}}
>>  f1 [] 42)
>>
>> (defn
>>  #^{:wadl {:url "/f2" :method "GET" :doc "The f2 function."}}
>>  f2 [] "eleventy-seven")
>>
>> ;;; ================ src/ctest/core.clj ================
>> (ns ctest.core
>>  (:use ctest.funcs))
>>
>> (def wadl-meta (list (meta ctest.funcs/f1) (meta ctest.funcs/f2)))
>
> There is indeed a bug in how defn copy metadata from the var to the fn:
> user=> (defn foo {:bar :baz} [] 42)
> #'user/foo
> user=> (meta #'foo)
> {:ns #<Namespace user>, :name foo, :file "NO_SOURCE_PATH", :line 221,
> :arglists ([]), :bar :baz}
> user=> (meta foo)
> {:ns #<Namespace user>, :name foo}
> user=> (defn foo {:lucy :ethel} [] 43)
> #'user/foo
> user=> (meta #'foo)
> {:ns #<Namespace user>, :name foo, :file "NO_SOURCE_PATH", :line 224,
> :arglists ([]), :lucy :ethel}
> user=> (meta foo)
> {:ns #<Namespace user>, :name foo, :file "NO_SOURCE_PATH", :line 221,
> :arglists ([]), :bar :baz}
>
> There you see that the fn got the previous metadata and not the current. I'm
> going to open a ticket.
>
> Christophe
>
> --
> 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



-- 
Jim Menard, http://www.io.com/~jimm/

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