|
|
|
|
|
by thom
2226 days ago
|
|
Not to say this is bad or incorrect, but this is very unidiomatic Clojure. I would question the amount of global state, and the broad use of loops inside threads. This can’t be fun to try and test! Perhaps better would be to make pure functions to take current telemetry as an argument and return actions as outputs, perhaps all at once or more likely individually for each control. You could then capture all of this inside core.async go-loops to manage the control flow and timeouts, but you could also probably build something simple with one or more agents wrapping the current state and updating a set of commands to be executed later. Another argument for core.async would be to make it easier to funnel all commands into a single channel because I’m not entirely convinced a WebDriver is multithreaded, but perhaps the library manages that for you. Anyway, cool stuff! |
|
That makes it sound you approach this from a haughty presumptuous, uncharitable angle.
It sounds like you exclude the possibility that the author did not try it "your way" first, for example, but found a simpler way to implement it.
"That's not the most obvious to do it IMO" or "I would have preferred to do it like this..." are much better ways to approach this. Programs should be beautiful and understandable, but "idiomatic" sounds it excludes lots of simple beautiful solutions to a problem out of pure dogma.