type-hints in macros must be treated the same way as in Clojure, using the
reader-level type-hint won't work:

(defmacro myfn [name params & body]
  `(defn ~(vary-meta assoc name :tag 'boolean) ~params ~@body))

David

On Mon, Mar 23, 2015 at 3:58 AM, Mike Thompson <m.l.thompson...@gmail.com>
wrote:

> I have a macro:
>
> (defmacro m
>   [x]
>   `(if-not ^boolean  js/goog.DEBUG  ~x))    ;;; NOTICE the type hint
>
>
> I use it:
>
> (macroexpand-1 '(m blah))
> ;; =>  (clojure.core/if-not js/goog.DEBUG blah)
>
> Notice how the type hint is gone. But I need that type hint there
> otherwise the if test on js/goog.DEBUG doesn't work.
>
> If I put this in:
> (set! *print-meta* true)
>
> then I can see the type hint metadata in there, just not available somehow
>
> So ... I'm stuck.  Google searches show up some talk about using
> "with-meta" but I can't seem to make that work either.
>
> Any help with the correct magic appreciated.
>
> --
> 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 clojurescript+unsubscr...@googlegroups.com.
> To post to this group, send email to clojurescript@googlegroups.com.
> Visit this group at http://groups.google.com/group/clojurescript.
>

-- 
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 clojurescript+unsubscr...@googlegroups.com.
To post to this group, send email to clojurescript@googlegroups.com.
Visit this group at http://groups.google.com/group/clojurescript.

Reply via email to