This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-05-18
Channels
- # announcements (6)
- # babashka (137)
- # beginners (115)
- # biff (4)
- # calva (24)
- # cider (1)
- # clj-kondo (15)
- # cljs-dev (18)
- # cljsrn (1)
- # clojure (43)
- # clojure-australia (1)
- # clojure-europe (11)
- # clojure-germany (3)
- # clojure-nl (3)
- # clojure-spec (40)
- # clojure-uk (6)
- # clojured (1)
- # clojurescript (24)
- # code-reviews (14)
- # core-logic (5)
- # cursive (24)
- # datahike (2)
- # datomic (3)
- # deps-new (9)
- # events (5)
- # figwheel-main (1)
- # fulcro (7)
- # helix (3)
- # honeysql (8)
- # jobs (4)
- # jobs-discuss (7)
- # lsp (59)
- # malli (9)
- # mid-cities-meetup (1)
- # nrepl (2)
- # off-topic (27)
- # portal (11)
- # re-frame (16)
- # reitit (1)
- # releases (12)
- # remote-jobs (4)
- # shadow-cljs (48)
- # spacemacs (1)
- # vim (9)
- # xtdb (14)
Hey! I wrote a macro that does templating like the syntax quote (with ~
and ~@
). The idea is very similar to https://github.com/brandonbloom/backtick
Kondo struggles with it since it lints the given form like any Clojure code. That would be easily solved if there was a "lint as syntax quote" option. Maybe is there already something resembling that?
@adam678 Probably writing a hook for this is your best bet, or suppress warnings inside this macro
I have one similar macro like this called $
which is part of babashka.process. clj-kondo has built-in support for that
Okay, thanks! Writing those hooks is always a fun puzzle (well, maybe not always)
@adam678 In your case, just expanding the body from (your-macro ...)
to
`(do ...)
should be sufficient?I'm going to do some experiments now, I believe I should rather traverse the given form and extracts everything enclosed in (clojure.core/unquote ...)
and (clojure.core/unquote-splicing ...)
What's encapsulated in those will always be valid Clojure, whereas everything outside is actually Convex Lisp in my case
Is there a way for interacting with QuoteNode
? Any node manipulation must happen via the hook api, right?
hmm, good point, there is probably no way to generate a syntax-quote
, but a normal quoted one can be generated using (list-node (list* (token-node 'quote) ...))
I think I can manage, with a little indirection. It's more about recognizing literal unquoting (combination between returning false on list-node?
and guessing unquote
and unquote-splicing
from the sexpr).
Is there an obvious reason why you removed support for map nodes?