MichaelDrogalis / dire

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

Remove hooks #5

Closed MichaelDrogalis closed 9 years ago

MichaelDrogalis commented 11 years ago

It would be nice to have function to remove each type of hook that you can add. Example:

(defn add-one [n]
  (inc n))

(with-precondition! #'add-one
  :not-two
  (fn [n & args]
    (not= n 2)))

(remove-precondition! #'add-one :not-two)
dparis commented 10 years ago

I'm going to look into this, seems pretty straightforward at first glance.

MichaelDrogalis commented 10 years ago

Thank ya! :)

MichaelDrogalis commented 10 years ago

@dparis I got out a version with your removal functions and some banged versions that I wrote on 0.5.2-SNAPSHOT. I now have need of them :)

Need to write tests, then I'll pitch it over to you for code review before putting it out on 0.5.2.

dparis commented 10 years ago

Awesome. I've been super swamped this last week between continual deadline work and my wife and I moving across town. Be happy to review once you get those changes finalized.

Turns out I was misunderstanding the way the supervisor hook thing worked, I assumed that the function meta was orthogonal from way the hook was implemented. I haven't dug into it yet, but from your description it sounds like at the time of calling one of the bang methods, the meta gets frozen into the hook?

MichaelDrogalis commented 10 years ago

That's 100% exactly what happens.

Happy moving!

On Wed, Nov 6, 2013 at 3:47 PM, Dylan Paris notifications@github.comwrote:

Awesome. I've been super swamped this last week between continual deadline work and my wife and I moving across town. Be happy to review once you get those changes finalized.

Turns out I was misunderstanding the way the supervisor hook thing worked, I assumed that the function meta was orthogonal from way the hook was implemented. I haven't dug into it yet, but from your description it sounds like at the time of calling one of the bang methods, the meta gets frozen into the hook?

— Reply to this email directly or view it on GitHubhttps://github.com/MichaelDrogalis/dire/issues/5#issuecomment-27912051 .

MichaelDrogalis commented 10 years ago

Got an unexpected nugget of free time!

Pull request out for master from develop.