Fork me on GitHub
#re-frame
<
2015-12-10
>
pepe13:12:33

Just FYI, today I am gonna live code in re-frame at our regional functional programming meetup 😉. Hope everything will go fine

jstew13:12:11

Live coding... you're brave simple_smile

pepe13:12:42

well I have very good experience with re-frame and live coding 😉. Month ago, I was teaching on my Uni, and live coded as well, without any bigger issues

jstew13:12:45

Good luck, I bet people will be amazed watching state change without reloading the browser.

pepe13:12:11

exactly. And how easy messaging could be 😉

jstew13:12:50

I've showed re-frame to a few javascript/ruby co workers and they were very impressed.

pepe13:12:16

😉

pepe13:12:45

I am still every day, even after that 3 months or so

martinklepsch17:12:07

I just wrote a handler that takes paths (into app-db) and transitions values in those paths, i.e. assigns a value or updates it according to some spec.

martinklepsch17:12:54

Now I noticed that this adds some coupling between app db structure and my dispatched events (vs. everything is handled within the handler)

martinklepsch17:12:54

I wonder if someone has an opinion to offer or more generally what you're doing to not end up with 100s of super simplistic handlers just toggling or assigning values

gabe18:12:15

@martinklepsch: something that i’ve been doing w/ subscriptions that i’m going to start doing w/ my super simple handlers is use naming conventions and just loop through a collection of keywords to do the handler registration

gabe18:12:33

(def state-kws [:foo :bar :baz :quux])

(doseq [k state-kws]
  ;; a simple pass-through from the db
  (rf/register-sub k (fn [db _] (reaction (k @db)))))

gabe18:12:37

but then this prbly wouldn’t get rid of your coupling. might actually make it tighter

gabe18:12:52

unless you use a map

roberto18:12:16

but it is not re-frame, but I think he is on to something there.

danielcompton20:12:29

@martinklepsch: you could make a handler like :mutate-db which gets passed a path (or part of a path) and a value. It’s a tradeoff between number of handlers, and complexity of handlers and app

mccraigmccraig22:12:40

martinklepsch: i have some similar handlers... feels a bit icky, but the alternatives seemed worse