Fork me on GitHub
#missionary
<
2021-12-29
>
Panel07:12:52

On the comparison with Rx https://github.com/leonoel/missionary/blob/master/doc/tutorials/rx_comparison.md, the author use a macro called drain. (defmacro drain [flow] (m/? (m/reduce (constantly nil) ~flow)))` Why use a macro here ? since flows are pure we couldn't we just use a defn ?

leonoel08:12:06

a function would work here indeed

Panel08:12:33

I often run into an issue, when I interrupt the currently evaluated m/? block with cider, then the following values returned from a m/? is a ThreadLocal, if I restart the repl it all goes back to normal. #object[java.lang.ThreadLocal$SuppliedThreadLocal 0x276bf8ff "java.lang.ThreadLocal$SuppliedThreadLocal@276bf8ff"]

leonoel08:12:21

it is a leaking internal, it usually means you called m/? in an m/sp but indirectly, i.e not in the lexical scope

Panel08:12:53

I don't understand the last part

leonoel08:12:11

do you have a minimal repro ?

Panel08:12:37

I'll get back when I do, thanks mate

ribelo10:12:17

@U01SBSXRRH6 speaking the language of simple people and mortals, you can use m/? only directly in m/ap or m/sp, just like <! in go block in core.async

Panel13:12:38

because the macro can't rewrite it if its in a fn

leonoel13:12:17

there's an issue about producing a better error message in this case https://github.com/leonoel/missionary/issues/35

👍 1
Panel13:12:40

I guess it also apply to ap block ?

ribelo14:12:23

you can use a macro

ribelo14:12:39

instead of function

leonoel16:12:38

ap too, yes

Panel22:12:09

Maybe it could be helpful to document the behavior in the doc string.