Closed zevv closed 8 months ago
This is unfortunate behavior relating to closure capture. When you wrap the (test ...)
code in the do form, and then create a local binding fun
around |(spawn-sleep)
, you are accidentally capturing too much state with the ev/do-thread
macro and that results in the above error.
I don't know if this is easy to fix, but I can look into improving closure capture to not capture the parent fiber.
Note that this also goes away if you use spawn-sleep
directly, or move (def fun |(spawn-sleep))
out of the do block.
I'm going to mark this as fixed for now, but I still think there are some improvements to be made here. While the fixes above prevent this kind of error from happening in the case of this macro, we still could reduce variable capture from closures even more than we do already.
Reporting for a friend who's too lazy to report this himself.
The snippet below results in
Removing the
do
makes this problem go away.