On Mon, Oct 17, 2016 at 9:46 PM, James Gatannah <james.gatan...@gmail.com>
wrote:

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

You can use the alias to do that, if you have a ns declaration like this:

(ns test.core
  (:require [com.foo.project.schemas :as sch]))

Then you can use the alias to get to the specs in that namespace

::sch/bar => :com.foo.project.schemas/bar

Cheers,
Mauricio

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

Reply via email to