I have the same understanding of when contracts and type annotations are 
checked. It seems like they would compliment each other quite nicely 
because you could catch all type errors at compile time and leave contracts 
for runtime. However, it seems that forms such as define/contract cannot be 
used with type annotations. I also noticed that both contracts and type 
annotations use the -> syntax; could that be related to why they don't work 
together?

On Sunday, December 16, 2018 at 2:09:05 AM UTC-9, Zelphir Kaltstahl wrote:
>
> As far as I know contracts in Racket are evaluated at run time, for 
> example when calling a procedure from another module and the module has a 
> contract for the procedure, while types of typed Racket are evaluated at 
> read time. They seem to be independent concepts. I am not sure how to use 
> both of them in the same project. However, I remember, that I also tried to 
> use contracts additionally when using typed Racket once or twice and ended 
> up having only contracts, because of some problem. What I do remember is, 
> that I had some typed Racket type inference problems, when I had some kind 
> of nested for loops. It might be, that this is, why I ended up using only 
> contracts and it might have been a solvable problem, had I saved that code 
> and asked here on the mailing list.
>
> > I recently started learning Racket and quickly switched to Typed Racket. 
> For the most part I've been very happy with it, but I'm unclear on whether 
> it's possible to create contracts in Typed Racket (for expressing 
> constraints other than type requirements). I've been unable to find an 
> explicit answer to my question in the docs for either contracts or Typed 
> Racket, but I've run several experiments and it seems that contracts are 
> incompatible with Typed Racket. This discussion 
> <https://www.google.com/url?q=https%3A%2F%2Fstackoverflow.com%2Fq%2F47001662&sa=D&sntz=1&usg=AFQjCNHP7UYj6Jmg5J8xshJifq_UlAlAxQ>
>  seems 
> to support my conclusion. 
>
> > If you can't create your own contracts in Typed Racket, are you meant to 
> limit all of your contract-related needs to type requirements? Or just use 
> vanilla Racket if you need a full-fledged contract system? Additionally, 
> could someone point me to the documentation that would have answered by 
> question (if it exists)?
>
> > Thanks!
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to