On Saturday, October 15, 2016 at 10:17:15 PM UTC-5, Josh Tilles wrote: > > I’ve got a couple questions for Alex Miller and/or the other Cognitect > folks. >
That isn't me. I'm just chiming in from the peanut gallery. Must of my "experience" so far stems from converting my toy projects from prismatic schema to spec. > > 1. *Are single-segment namespaces still “bad” when it comes to > registering specs under qualified keywords?* > In the past, single-segment namespaces have been discouraged in the > Clojure community—both because of Java interop concerns and because of the > possibility of name-collision when combining projects. However, many of > the > spec examples I’ve seen have demonstrated registering specs under keywords > qualified by a single-segment namespace. For example, the guide’s > section on multi-spec <http://clojure.org/guides/spec#_multi_spec> > defines :search/url and :error/message. Is that because > namespace-qualifiers of specs shouldn’t be under the same constraints as > namespaces used to organize code? > > This part of the question interests me a lot. I've found myself defining a lot of specs in, say, the com.foo.project.schemas namespace. This used to be extremely convenient, due to ns aliases. I think the docs say that I should be able to set up the same kind of basic aliasing so that I can just refer to those specs as (for example) :c.f.p.s/whatever. But I haven't been able to actually get that to work yet. I've found myself with a lot of definitions that look like (apologies for the formatting/whitespace): (s/def ::socket-description (s/keys :opt [::client-keys ::server-key] :req [::ctx :com.jimrthy.cljeromq.common/direction ::port ::sock-type :com.jimrthy.cljeromq.common/socket :com.jimrthy.cljeromq.core/url])) That isn't *too* bad. But this sort of thing gets annoying when I'm nesting these things into other namespaces. Especially from the REPL, which is lisp's strongest selling point (to me). I'm willing to bet that I've just missed a talk somewhere about how this is supposed to work. Or maybe I just need to keep working on getting my head wrapped around these changes. I don't want to hijack your thread. This was more of a "Me too! This is why...I think" sort of thing.. > 1. I’m *guessing* not; it seems more likely that the single-segment > namespaces have been used only to keep the code snippets straightforward > and focused on spec, and that “real” code would alias (e.g.) > my-company.my-project.search as search before defining a ::search/url > spec. > > > Thank you for your help. I really appreciate it. > Again, me too! Thanks, James > > Best, > Josh > -- 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.