Fork me on GitHub
#re-frame
<
2015-09-27
>
pupeno09:09:21

Does anybody know why re-frame uses functions behind multimethod instead of using the multimethod directly? https://github.com/Day8/re-frame-template/blob/master/src/leiningen/new/re_frame/src/cljs/views_recom_routes.cljs#L40-L43

pupeno09:09:58

Is there any value in outputing [about-panel] instead of the markup for it directly?

danielcompton09:09:18

@pupeno: I’m not quite sure if you’re asking why they use [about-panel] instead of (about-panel), or if you’re asking why they’re using multimethods at all. If it’s the former, then check out https://github.com/Day8/re-frame/wiki/Using-%5B%5D-instead-of-%28%29. If it’s the latter, then I think it’s just a clean way of switching on the subscription parameter.

pupeno09:09:39

danielcompton: I’m familiar with [] vs () and multimethods and how they work. My question is why use the multimethod to output [about-panel] instead just outputting [re-com/v-box :gap “1em" :children [[about-title] [link-to-home-page]]]

pupeno09:09:54

That is, why the second level of indirection there? Is it useful for soemthing?

danielcompton09:09:52

Don’t think so particularly, other than it being slightly cleaner and more modular. However I didn’t write it, @gadfly361 is probably the best one to ask?

danielcompton09:09:18

@pupeno: so you can go your own way on this one simple_smile

hkjels09:09:26

@mikethompson: if you think it’s a good idea, I can help out.

hkjels09:09:43

On another note: is anyone working on a sync approach with Datomic like om next?

hkjels09:09:45

The declarative queries part and the client being in control, really makes sense I think, so I’d like to see something of that kind with re-frame

danielcompton09:09:30

@hkjels: I'm working on some stuff with RethinkDB. It similar in intent to Om.next, but will probably come out a bit different

hkjels09:09:52

That would be the live-sync part and not declarative queries I guess?

hkjels10:09:50

Or the whole concept?

hkjels10:09:07

RethinkDB looks pretty cool. Haven’t had the chance to mess with it

mikethompson10:09:56

@pupeno: I didn't write that code, but be cautious about using "static" lookup datasctructures like say this:

(def  panels  {
      :home-panel home-panel
      :about-panel about-panel
      :default  [:div]})
See: https://github.com/reagent-project/reagent/issues/153#issuecomment-118449228 As that ticket makes clear, you can get problems with figwheel The multimethod approach avoids that sort of "static data structure" issue with figwheel Just a thought.

pupeno10:09:00

My point is to keep the multimethods, just not the functions.

mikethompson10:09:46

@hkjels always keen for help simple_smile

hkjels10:09:24

@mikethompson: OK. I’ll do some sketches 👍 If you have any thoughts at all about logo, symbols, colors etc, let me know

danielcompton10:09:10

@hkjels: SQL queries are declarative too :) it's going toward the same goal, but it will probably end up looking quite different

hkjels10:09:36

That’s true. I just think Datalog is abit more future-proof. If you have a look at atomic and datomic-junk, you can see how minimal the syntax could be in best-case

hkjels10:09:46

or the lack of syntax simple_smile

reefersleep13:09:20

Hello everyone

reefersleep13:09:41

I'm just beginning to learn re-frame, and I'm wondering if there are any drawbacks? I have only heard praise so far simple_smile

darwin15:09:19

@reefersleep: welcome! I’m afraid your question is too general. re-frame library is an implementation of general re-frame pattern. there are probably some drawbacks when applying it in concrete situations. one trivial drawback with re-frame library is that you are adding yet another dependency to your project, you have to learn the pattern and use it properly. there might be some performance or flexibility concerns as well. for example re-frame library expects you to have only one “global” app-db and it depends on reagent. relaxing this is possible, but involves some work.

xlevus15:09:22

is there a reason there's no bundled macros for views/handlers/subs ?

reefersleep15:09:31

@darwin: cheers simple_smile The things you mentioned do not seem scary to me, which is good!

gadfly36118:09:41

@pupeno @danielcompton @mikethompson regarding routes in the template: the original impetus was to play nice with figwheel. And after doing it that way, it does feel cleaner to only put a reference in app-db instead of the whole function itself (feels more 'Elm'y)

val_waeselynck19:09:46

@reefersleep: one limitation I do see is that re-frame encourages a top-down approach to building your app: all your components leverage a single toplevel global context, which may make them less 'portable'. I don't really see this as the drawback, more like a limit of its application space.