-
|
As the title says, what's considered the most idiomatic way to use a module inside a macro. For example, the naive (dirty) way would be to # macros.janet
(import some-module)
(defmacro a-macro []
~(some-module/function params))and then use it as # some-file.janet
(import some-module) # < need to import this even if we don't use it directly
(import ./macros)
(a-macro)The issue here is that (let [sm (import some-module)]
(sm/function params))But unless I missed something while going through the documentation there is no way to do this in Janet 🤔 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
|
The It allows you to use the same unquote trick for hygiene on macros as you use on functions. Note that as-macro is not unquoted. |
Beta Was this translation helpful? Give feedback.
The
as-macromacro is a hack for this.It allows you to use the same unquote trick for hygiene on macros as you use on functions. Note that as-macro is not unquoted.