[Python-3000] Fw: typeclasses, duck-typing

Phillip J. Eby pje at telecommunity.com
Wed May 10 18:39:57 CEST 2006


At 11:21 AM 5/10/2006 +0100, Ben.Young at risk.sungard.com wrote:
>Have you taken a look at ConceptGCC? (
>http://www.osl.iu.edu/~dgregor/ConceptGCC/)
>
>It's basically a first cut at implementing the Concepts which will be
>availiable in the next version of C++. They basically provide full compile
>time "duck typing" as well as adaptation for types that don't exactly fit
>the concept. (e.g if the type doesn't have a length method, here's how you
>provide it.
>
>It's a very powerfull idea, and probably well worth looking at for
>inspiration.

FWIW, I skimmed through the tutorial; it appears that a "Concept" is 
roughly equivalent to a typeclass in Haskell, and a "Model" is roughly 
equivalent to a typeclass instance.

One of the papers on the site mentions something called "concept-based 
overloading", which if I'm reading it correctly, is the idea that's at the 
heart of this thread; i.e., it should be possible to say that a particular 
implementation of one operation is dependent upon the availability of an 
implementation of some other operation.



More information about the Python-3000 mailing list