looks like magic to a beginner, trying to parse

` is quote while ~ is unquote but what is ' compared to `

also, does :tag in meta have a special meaning reserved for type hints?

is there a good reference that explains how macros work in clojure? like
why we need to quote and unquote (assuming that's not particular to macros
but macros is only place i've seen it used)?







On Tue, Mar 24, 2015 at 6:04 AM, Mike Thompson <m.l.thompson...@gmail.com>
wrote:

> On Tuesday, March 24, 2015 at 10:31:00 PM UTC+11, David Nolen wrote:
> > On Tue, Mar 24, 2015 at 3:57 AM, Mike Thompson <m.l.tho...@gmail.com>
> wrote:
> >
> >
> > The Google Closure compiler does deadcode eliminate the "x" if you do it
> this way.  And it avoids the complete nightmare of getting a type hint
> added to js/goog.DEBUG through a macro (which seems impossible to me).
> >
> >
> > I just tested the approach that I suggested and verified it works the
> same as it does in Clojure.
> >
> >
> >
> > (defmacro when-debug [& body]
> >   `(when ~(vary-meta 'js/goog.DEBUG assoc :tag 'boolean)
> >      ~@body))
>
>
> Many Thanks!  That works. Phew, thank goodness.
>
> I can now see that your original code had "assoc" "name" incorrectly
> transposed and that, combined with my rookie macro-debugging-skills, meant
> a lot of thrashing about, wild tangents and hair pulling.  I can't wait to
> get better at this stuff.
>
> --
> 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