Fork me on GitHub
#re-frame
<
2022-04-19
>
rgm18:04:45

there isn't some "pro" way to pass variable args to the L2/L3 syntactic sugar, is there? eg

(reg-sub :foo
  :<- [:sub-with-arg %]
  :<- [:sub-with-two-args %1 %2]
  (fn [[a b] _) ,,,))

p-himik18:04:16

Right, you have to use an extra fn as a signal.

rgm18:04:18

alas ... I find the syntactic sugar encourages me to be more L3 when it's so easy

rgm18:04:37

I guess JS arity being JS arity I would not be all that surprised if re-frame re-wrote things so that internally this worked:

(reg-sub :foo 
  :<- [:sub-with-arg] ;; implicit first-arg, sub ignores second anyway
  :<- [:sub-with-two] ;; implicit first-arg second-arg
  (fn [[a b] [_ _first-arg _second-arg]] ,,,))
could be a bit of a head scratcher but at least things "documented" (BIG air quotes) in the 2nd arg of the second function

rgm18:04:12

but again, not really advocating this.

p-himik18:04:51

Big yuk, 100%.

rgm18:04:36

Just confirmed that no, this has not been working the whole time 🙃

rgm18:04:01

not that I'm necessarily advocating this