[racket-dev] [plt] Push #25244: master branch updated

From: Asumu Takikawa (asumu at ccs.neu.edu)
Date: Tue Aug 21 13:05:05 EDT 2012

On 2012-08-21 12:45:03 -0400, asumu at racket-lang.org wrote:
> | This enables the use of polymorphic contracts with generic
> | interfaces and their instances.

If you're curious how this can be used, I have an example up as a Gist
that I've also checked in as a test:

It reminds me of type classes since the generic functions themselves are
protected by polymorphic contracts (like how type class definitions
usually consist of polymorphic operations) and you can specify more
specific contracts for the instances of the interface (like
instantiating a type class at some type).

One caveat is that this doesn't work easily for generic functions that
might also dispatch to non-struct datatypes (e.g., dictionaries with
built-in hashes). You have to write more complicated contracts to handle


Posted on the dev mailing list.