MichaelDrogalis / dire

Erlang-style supervisor error handling for Clojure
483 stars 19 forks source link

Is there an advantage to the supervisor style? #32

Open didibus opened 8 years ago

didibus commented 8 years ago

Hi,

I'm curious to know what's the advantage of using the supervisor (erlang style) instead of the *! functions?

Thank You.

MichaelDrogalis commented 8 years ago

@didibus They don't mutate the functions in-place.

didibus commented 8 years ago

And what are the disadvantages of mutating the function in place? Could it lead to issues? What situations should I be aware of where it would be problematic and I should instead use supervisor?

Thank you.

MichaelDrogalis commented 8 years ago

I'm not aware of any issues, but the drawback is that you no longer have your original function. Same set of trade-offs as using a bash-in-place variable.

didibus commented 8 years ago

Ok, I see, so you wouldn't be able to call the function without the hooks being a a part of it anymore.

So there shouldn't be any Clojure specific corner cases to watch out for? Like the possibility that if I use my function too early, it hasn't been hooked up yet, or that it is being changed in the middle of something using it, etc?