Fork me on GitHub
#code-reviews
<
2019-07-22
>
dottedmag08:07:54

Please suggest how to improve this code (and whether it needs to be improved): https://gist.github.com/dottedmag/f38b25718cb151b81ed429312092546b (reformatted slightly, now at rev. 6)

dmaiocchi11:07:17

from my pov, doing a swap in a let, it mix side-effects withing the let, which in theory should be just an utility convenenice for having a scope variable`let` imho. Open to see what other think about that

dmaiocchi11:07:57

a part of this, Imho instead of if you could use the or construct but this is more style

hiredman17:07:10

use compare-and-set! instead of swap

hiredman17:07:54

using swap! for that kind of thing is asking for a race condition

hiredman17:07:37

I might use a semaphore instead of any of that

hiredman17:07:07

but I guess a semaphore wouldn't tell you which id is free

hiredman17:07:27

you could just use a linkedblockingqueue of ids