Fork me on GitHub
#clojure-nl
<
2018-10-05
>
thomas07:10:17

morning.... still working on that workitem that should have been finished 2 weeks ago

gklijs08:10:55

mine was merged yesterday, so today I get to fix a bug because the person that was working on it, doesn’t work today

lmergen09:10:27

i decided today that i officially hate protocols now, and i'm going to replace it with multimethods

lmergen09:10:06

i am having the weirdest repl-reload issues with protocols, which apparently is due to the order in which clojure.tools.repl.reload reloads the files

lmergen09:10:37

which leads in functions such as (partial instance? Foo x) suddenly throwing errors, because the derivative of Foo is not loaded yet at that point

dirklectisch11:10:53

@lmergen Why not use tools.namespace instead for reloading? They have a dedicated section in their docs that explains the problem with reloading protocols. https://github.com/clojure/tools.namespace#warnings-for-protocols

lmergen11:10:46

just looked, i'm using integrant.repl/reset-all, which apparently uses tools.namespace under the hood

lmergen11:10:55

the problem being that the refresh operation loads the files in the "wrong" order

lmergen11:10:21

i nailed it down to (. (:on-interface Foo) (isInstance x)) returning False, even when (supers (class x)) contains Foo

thomas11:10:15

computers suck

lmergen11:10:24

^ that sums up my mood today yes

dirklectisch11:10:06

It’s quite surprising that they are loaded in the wrong order since tools.namespace keeps a dependency graph of namespaces so that they are loaded in the correct order.

lmergen11:10:59

i wouldn't be surprised if i was doing something wrong

lmergen11:10:47

but it's a very, very annoying issue to debug, and i figured one of the leading causes is that it's not simple data, it's types

dirklectisch11:10:40

I can imagine. Hope you figure it out.

thomas12:10:44

@lmergen that has been my feeling the last week or so...

borkdude13:10:11

I have backed down from clojure.tools.repl.reload altogether. Manual eval per namespace works good enough for me.

lmergen19:10:12

yeah that doesn’t work too well with a component/integrant driven workflow though

lmergen19:10:02

but I agree with the idea that manual namespace evals can bring you very far