This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-09-27
Channels
- # announcements (1)
- # asami (10)
- # babashka (12)
- # beginners (26)
- # biff (4)
- # calva (42)
- # cider (1)
- # clj-commons (2)
- # cljs-dev (2)
- # clojure (179)
- # clojure-dev (2)
- # clojure-europe (45)
- # clojure-norway (16)
- # clojure-uk (3)
- # clojurescript (5)
- # datahike (1)
- # datascript (2)
- # events (3)
- # exercism (1)
- # fulcro (13)
- # funcool (3)
- # graalvm (23)
- # helix (3)
- # honeysql (1)
- # hyperfiddle (3)
- # lsp (51)
- # malli (2)
- # off-topic (27)
- # portal (18)
- # reagent (3)
- # reitit (3)
- # releases (8)
- # sci (5)
- # shadow-cljs (11)
- # xtdb (5)
Pls advice on rewriting a macro to sci 🙏 I am rewriting https://github.com/fulcrologic/fulcro/blob/main/src/main/com/fulcrologic/fulcro/react/hooks.cljc#L179-L188 (and use-effect) macro - what gives me trouble is that the original impl refers to itself, and to the other macro. How do I make such as recursive impl correctly? The simpler case:
1 (ns sci.configs.fulcro.react.hooks
2 (:require [com.fulcrologic.fulcro.react.hooks :as hooks]))
3 (defn ^:sci/macro use-lifecycle
4 ([&form &env setup] `(use-lifecycle &form &env ~setup nil)) ; FIXME Is this correct self-ref for a sci macro?
5 ([&form &env setup teardown] ... `(use-effect ...))
At line 4, when the macro invokes its other arity, should I have what I do, or
(sci.configs.fulcro.react.hooks/use-lifecycle &form &env
(hooks/use-lifecycle com.fulcrologic.fulcro.react.hooks/use-lifecycle
. So if it makes a simple replacement in that context, then it macroexpands that again in the same context, then perhaps the last one is correct?? 🙏The expansion should return the same as in clojure. the form and env are always inserted by the compiler/interpreter