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

I will add here that I have found quite a bit of leverage from being able 
to use Prismatic schema's data-representation for generating Avro schema 
from records.  Yes, we only support a subset of all possible Schema, since 
Schema also allows for arbitrary predicates as schema.  We've also had 
other occasions where we could write general functions that gave default 
values to fields that had the same Schema instead of relying on what that 
field is named etc.  
I always really liked that Prismatic Schema had a "data representation" and 
that seems to be the Clojure-way anyways.  I haven't dug into this too much 
yet, but I'm hoping that the Spec's do have some way to programmatically 
inspect them and utilize their structures for other purposes. 

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