> If I'm right then defining your 'globals' (for lack of a
> better word) like this would mean, among other things, that you really can't
> have two independent Noir apps defined/running in the same project - is that
> a correct assessment?

Just out of curiosity, could you expand on what you mean here?  What
types of situations would you need/want multiple independent Noir apps
defined/running in the same project?


On Wed, Sep 12, 2012 at 10:30 AM, the80srobot <a...@ingenious.cz> wrote:
> Hello,
>
> So I've been working on a project at work, that required me to code a simple
> web interface. I considered going with Noir, and while reading the code, I
> noticed a pattern that seems to repeat throughout most of the code that
> Chris Granger has published in Clojure. This is what I'm referring to:
>
>     ; these are at the top level in (ns noir.core)
>     (defonce noir-routes (atom {}))
>     (defonce route-funcs (atom {}))
>     (defonce pre-routes (atom (sorted-map)))
>     (defonce post-routes (atom []))
>     (defonce compojure-routes (atom []))
>
> Now, I am new to Clojure, but I am not new to (functional) programming and
> I'd like to think that I know a singleton when I see one. Is that really
> what these are? If I'm right then defining your 'globals' (for lack of a
> better word) like this would mean, among other things, that you really can't
> have two independent Noir apps defined/running in the same project - is that
> a correct assessment?
>
> Can someone more experienced shed some light on why it's done this way? My
> experience in functional programming has taught me to always limit my scope
> - I would think that either using thread-local bindings (and then rebinding
> them to child threads) or relying on lexical scope would be preferable to
> polluting the global state. Is this a Clojure best practice?
>
> Thanks. I'm looking to use Clojure a lot at work, and I'm trying to really
> understand the language before I throw it our production problems.
>
> ~Adam
>
> --
> 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

-- 
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