I just noticed I replied with a private message earlier > If you end up using a separate config file rather than project.clj, you > might find Carica https://github.com/sonian/carica useful. It allows > merging config files on the classpath into one effective config hierarchy > with predictable overriding behavior.
Thanks, I'll give that one a try. How about accepting a fn as argument to provide the config required? In > that case the user is free to use whichever library/hand-rolled code to > read config from a file. > > It's very simple: Leave configuration file management and stuff out of > the lib. Instead, pass the translations dictionary to your library as an > argument. > On your app level, you could still load the desired dictionary from a > config file but the lib should stay independent of this. About passing the config as an argument to my lib, I understand that's the purest approach and I would go with that in most cases, but in this case I feel it would be inconvenient for the lib's user. I'm doing calls to the lib everywhere in the code where a translatable string appears (and that's in a lot of places in my project, since it has a pure text interface). So if I wanted to pass the config in each lib call I'd have to add a parameter, make it available everywhere throughout the project and force the user to handle the config loading before making any function calls. The other approach would be to pass that configuration to some sort of init function of my lib, but it has the same problem: not being able to require any namespace that contains translatable strings before handling lib initialisation. I've tried something like that and it forced me to break apart my ns :requires, do initialisation, do the rest of the requires after. A lot of hassle to use a small lib. For context, this <https://github.com/facundoolano/clojure-gettext/blob/master/README.md> is how I expected my lib to work. I've used a similar approach in other languages, perhaps I need to rethink my design to better fit clojure. Thanks, Facundo. -- 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 unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.