Hi Ambrose,

I see, so a way to proceed is type the whole of the front end, but where we 
consume the server response we are on our own.

You mention predicates, can I infer from that that run-time enforcement of said 
types is not something that happens unless we explicitly make it happen (using 
the predicate)? Assuming everything everywhere is typed sufficiently I guess 
the only place that predicate is needed is on the typed/untyped boundary.

Is that right?

On Wednesday, 29 October 2014 17:05:23 UTC, Ambrose Bonnaire-Sergeant  wrote:
> Hi Colin,
> 
> 
> The ClojureScript port is still in progress.
> 
> 
> The story for casting values from untyped to typed land is non-existent. You 
> basically
> need to tell core.typed what types you're expecting from untyped land
> with an unchecked annotation, and it's up to you to make sure those
> assumptions are correct.
> 
> 
> This is a major problem that will be tackled at some point during my PhD.
> 
> 
> The closest thing right now to what you might want is 
> clojure.core.typed/pred, which turns
> a type into a predicate.
> 
> 
> Then (do (assert ((pred Foo) x) x) can cast your value.
> 
> 
> Otherwise you might want to use something like Schema at the typed/untyped 
> boundaries to
> validate data before they travel into typed land. But this is not a 
> particularly pleasant workflow.
> 
> 
> Thanks,
> Ambrose
> 
> 
> On Wed, Oct 29, 2014 at 12:42 PM, Colin Yates <[email protected]> wrote:
> I am thinking of using core.typed for the clojurescript layer but after 
> reading the docs it isn't clear to me how core.typed works in relation to 
> serialisation.
> 
> 
> 
> I get that core.typed does some static analysis at compile time, but what 
> about runtime? What happens when I deserialise from a blob returned from the 
> server, does it take it on faith that the defined typed contract is valid?
> 
> 
> 
> Or, is the only option to type that as returning Any, in which case how on 
> earth is it used?
> 
> 
> 
> My intention is to describe the structure of the various data structures 
> flying around the front end and consumed from the server with core.typed if 
> that helps.
> 
> 
> 
> Thanks!
> 
> 
> 
> --
> 
> Note that posts from new members are moderated - please be patient with your 
> first post.
> 
> ---
> 
> You received this message because you are subscribed to the Google Groups 
> "ClojureScript" group.
> 
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> 
> To post to this group, send email to [email protected].
> 
> Visit this group at http://groups.google.com/group/clojurescript.

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/clojurescript.

Reply via email to