Fork me on GitHub
#re-frame
<
2017-05-21
>
souenzzo03:05:48

I want to track all request's on my re-frame app. gensym should be a good idea? I thinking in "for each request I (conj requests my-unique-id) and on receive, I (disj requests my-unique-id)"

sandbags10:05:43

If there is one thing that will drive me from Clojure/Clojurescript it's the bloody impenetrable error messages

cmal10:05:50

It is the first cons on Slant.

sandbags10:05:46

I do not understand why they have to be so awful. Ruby and Erlang are just as dynamic and I rarely remember pulling my hair out trying to figure out what an error meant or why the stack trace seemed to be completely unhelpful

sandbags11:05:40

my error turned out to be accidentally putting () around a value when I was rewriting some code leading to an "unhandled arity 0"

cmal11:05:18

I don't know much. But I hear something about this, people said that is because of Clojure are a hosted language, so it's error message relys on the host language's stack trace.

sandbags11:05:16

maybe, but in many cases (e.g. in this case) the error is being raised in CLJS land

cmal11:05:28

When I am developing Clojure, there are always some error that only pop a nullpointer to me, which drives me crazy.

sandbags11:05:52

i think it's an attitude problem and maybe a blind-spot for Rich (he's gotta have some) about good error handling

jsa-aerial16:05:42

sandbags: It has always been a priority thing - limited resources and all. With spec, that likely will be changing. Ruby's been around for over 25 years, Erlang for well over 30 years. Python around 30 years. One would hope this would be a more mature area for them. Also, to be frank, Ruby and Python errors can be pretty criptic.

cmal11:05:34

unhandled arity 0... haha..

sandbags11:05:34

presumably it works okay for him and the rest of core

sandbags11:05:47

I ended up calling a map as a function but without a key to lookup

sandbags11:05:05

technically "Unhandled arity 0" is perfectly true but not very helpful in figuring out what went wrong .. perhaps it's just my brain/observational skills at fault

cmal11:05:26

So maybe tomorrow there will be a AI website where we can input the error message and it returns to us the probable problem we have in our code.

cmal11:05:21

88 bye, go to super.

akiroz16:05:00

I totally agree on the error messages, they usually just point out the result of the mistake I made rather than the cause...

akiroz16:05:56

and after a few layers of macro expansion, you're pretty much debugging blindfolded.

akiroz16:05:05

many of these things that could've been caught by a static analyzer made their way into runtime

cmal16:05:47

agree. Can I ask a question? I am using echarts and it has a setOption function which take an object as it parameter. This object is complicated and some of its fields are functions. Can I write these functions as clojure functions and then call clj->js on the whole object? Thanks.

akiroz16:05:56

lol we've already driven this channel completely off topic, I suggest moving this to #clojurescript

jsa-aerial16:05:19

While they are not as good as they could be, I've never understood why some people have such a hard time with them. Also, never understand why some people seem to get a lot of NPE - I almost never get those and the reason is often obvious. But, yes, this is #off-topic stuff

akiroz16:05:58

same here, I generally don't have a whole lot of trouble with them either, but it doesn't change the fact that they suck and could be better. 😉 bad error messages mostly come from macro expansion and NPEs usually come from Java interop.

sandbags17:05:39

Using re-com what am I supposed to put paragraphs of text into when inside, e.g., a v-box?

sandbags17:05:27

i'm finding my text extending off the side of the page

sandbags17:05:31

a ha, there is re-com/p somehow I missed that

sandbags17:05:54

maybe it should be in the typography section of the re-demo

lgessler18:05:58

has anyone come across a good medium-sized/large re-frame app that's open source? I'm having trouble figuring out how to scale up my codebase in a clean way and it'd be nice to see an example

leontalbot19:05:52

Hello re-frame!

leontalbot19:05:16

what is the idiomatic way of writing this:

leontalbot19:05:31

(defn current-user [db _]
  (get db :current-user))

(defn current-user-avatar [db _]
  (let [cu (get db :current-user)]
    (get-in db [:users cu :avatar])))

(re-frame/reg-sub :current-user current-user)
(re-frame/reg-sub :current-user-avatar current-user-avatar)

leontalbot19:05:06

I suppose there is something more dry...

mikethompson23:05:42

@leontalbot Nothing other than the obvious ...

(defn cur-user [db]
   (get db :current-user))

(defn current-user [db _]
  (cur-user db))

(defn current-user-avatar [db _]
   (get-in db [:users cur-user(db) avatar]))

(re-frame/reg-sub :current-user current-user)
(re-frame/reg-sub :current-user-avatar current-user-avatar)

escherize23:05:44

you been doing some javascript, mike?

escherize23:05:49

cur-user(db)