For the purposes of my DSL, I want to allow rules to be defined which take no parameters. So I have written a macro which basically looks like defn, except you don’t need to put an empty vector for the parameters, because there never will be any. The macro is -
(defmacro rule
“a business rule”
[name & statements]
`(defn ~name
~@statements))
This works, but the annoying thing is that in any editor/IDE I have used (Cursive, VS Code with Calva) the name of the new rule is highlighted as undefined. I can fix this by modifying my macro to take a symbol instead, but this just introduces a little bit more complexity.
Is there a way of making this name not show up as an error ?
Obviously it doesn’t happen when you use defn - but is this something that is built in ?
EDIT - one potential solution: I could just use def in conjunction with a modified version of the rule macro which uses fn instead of defn,
eg, (def MyRule (rule …))