Ah yep, (var app) is probably a better idea than #(app %).

- James

On Feb 23, 11:55 pm, Mark McGranaghan <mmcgr...@gmail.com> wrote:
> > Basically because wrap-reload is a function, so app is evaluated
> > before it is passed to wrap-reload.
>
> Right. To elaborate, the code "(reload/wrap-reload app '(ns1 ns2))"
> invokes the wrap-reload function with the current value of the "app"
> Var, which is a specific and immutable function. The reload middleware
> may subsequently reload the namespaces and therefore change the value
> of the app Var, but the value that is used to invoke (app req) within
> the middleware remains unchanged.
>
> I'd therefore suggest passing a Var instead of a function:
>
> (reload/wrap-reload (var app) '(ns1 ns2))
>
>  In this way, each time app is invoked within the middleware, it first
> goes to get the current value of the app var and then uses that value
> to evaluate the request argument; i.e. the reload works.
>
> Note that if the implementation of app itself never changes, only the
> functions that it in turn calls, then the (var app) bit becomes
> unnecessary.
>
> HTH,
> - Mark

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

Reply via email to