On Thursday, May 28, 2015 at 6:37:56 PM UTC+10, Ruslan Prokopchuk wrote:
> fns are normal values, I guess you got strange glitch, try with the fresh 
> vm/repl:
> 
> (def fff ^{:a 1} (fn [] 4))
> #<[object Object]>
> => nil
> 
> (meta fff)
> => {:a 1}
> 
> (meta ^{:a 1} (fn [] 4))
> => {:a 1}
> 

Many Thanks Ruslan!!  I've got it now. 

For anyone following later, here's how it can be done ... 

(def fn-name 
   "docstring"
   ^{:a 1}     ;; metadata to be put on the following fn
   (fn   [args]   .....))

That results in "fn-name" binding to an fn which has metadata {:a 1}.

David Nolen has explained as follows ... "as to why we don’t actually put 
runtime metadata fns on functions would degrade advanced compilation.  both 
dead code elimination and code splitting"

--
Mike

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/clojurescript.

Reply via email to