> I have nothing against callback, though i am bit unsure how it would work in > case where we would like client to connect to multiple servers. Seems like > this callback would depend on some kind of global state which probably > assumes there is one client in application.
I was originally thinking a higher order function that uses closures to close over whatever connection or other arguments. As long as the HOF has the right type signature, the function that produces the HOF could take whatever arguments. The other method I was kicking around was an extendable object type + method dispatch. However, not opposed to the method you suggest. Might workshop a couple things this weekend and see what feels best.
