Hi Meikel,

On 21 February 2011 15:18, Meikel Brandmeyer <[email protected]> wrote:
> Hi,
>
> Is there a reason, not to use the function object directly?

Just that I wanted to prevent adding the same function multiple times.
But it was just for testing convenience, and perhaps over-complicating
things a bit.

>
> (def hook (atom #{}))
>
> (defn add-to-hook
>  [h & fs]
>  (swap! into h fs))
>
> (defn run-hook
>  [h]
>  (doseq [f @h] (f)))
>
> (defn test [] nil)
>
> (let [test2 (fn [] nil)]
>  (add-to-hook hook test test2))
>
> (run-hook hook)
>
> It should work even with aliased functions. However with "hot-
> patching" during development you might run into trouble. But for
> production systems it should be fine, no?

Yes, and thanks for the various other improvements!


Cheers,
David

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to