On Tuesday, May 24, 2016 at 7:26:57 PM UTC-5, Leif wrote:
>
> Hi, Alex, thanks for the responsiveness.
>
> The paths refer to tags in the schemas, not keys in the map. However, this 
>> has been asked about several times today and Rich has added support for a 
>> :in clause that will track the key paths to master and that will be in 
>> alpha2. 
>>
>
>  Where is this discussion thread?  I wouldn't want to ask duplicate 
> questions. 
>

It was on the clojurians.net Slack room #clojure_spec
 

>
> Is there a recommended way to introspect specs for our own purposes 
>> (coercion, code generation)?  An interpreter on the output of 'describe' 
>> might work (although it's a little complicated for fn specs), but I wanted 
>> to know if you all had any thoughts or plans for the future here.
>>
>  
>
>> Could you give more details on what question you would like to ask?
>>
>  
> Better people to ask would be those that have a lot of experience writing 
> translators for specs, like the Schema devs.  But I'll give my muddled 
> thoughts here:
>
> Right now, the internals of different instances of Spec are private.  So, 
> to write a translator from a Spec to the approximate json or avro schema it 
> specifies, or translate from a Spec to a function that coerces a String to 
> a data structure that conforms, I would have to:
>
> 1. Parse the output of 'describe' back into a description of the Spec's 
> internals (if I can get at all of them)
>

I'm not sure why you need the internals - the vocabulary of spec is 
relatively small (+ the open-ended world of predicates). It doesn't seem 
possible to translate open-ended predicates to fixed types in json or avro, 
but you could look for known predicates.

2. Interpret / translate the parsed tree
>
> In fact, the current Spec protocol, in my mind, is actually 4 protocols, 
> one for 4 different translators you all have written:
>

I'm not sure you need to know or care about this to translate specs into 
something else.
 

>
> (defprotocol Spec
>   ;; Spec->Conformer
>   (conform* [spec x])
>   :: Spec->Explainer
>   (explain* [spec path via x])
>   ;; Spec->Gen
>   (gen* [spec overrides path rmap])
>   (with-gen* [spec gfn])
>   ;; Spec->Describer
>   (describe* [spec]))
>
> But this implementation hiding dooms clojure/core to write *all* the 
> translators.  This just seems weird given how most other Clojure features 
> are open and user-extensible.
>

The core vocabulary for spec is relatively small - the "open" part comes 
through predicates (which can be anything) or conditional mechanisms like 
multi-spec.
 

>
> --Leif
>

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