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

Ben.Young at risk.sungard.com Ben.Young at risk.sungard.com
Wed May 10 12:21:09 CEST 2006


python-3000-bounces+python=theyoungfamily.co.uk at python.org wrote on 
09/05/2006 18:25:29:

> On Tuesday 09 May 2006 13:10, Antoine Pitrou wrote:
>  > Interestingly, there was a GNU addition to C++ named "signatures" 
which
>  > achieved roughly the same thing: some kind of compile-time 
duck-typing.
>  >
>  > http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_5.html#SEC112
> 
> I remember that, thinking it was really kind of cool, and wanting toplay 
with 
> it.  Never had time to do so.
> 
>  > Apparently it has been removed in gcc 3 or 4.
> 
> That's right.  That's when I became glad I hadn't spent time writingcode 
that 
> relied on that feature.  :-)
> 

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.

(For further details search for Concepts in the paper index at 
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n1969.html)

Cheers,
Ben

>   -Fred
> 
> -- 
> Fred L. Drake, Jr.   <fdrake at acm.org>
> _______________________________________________
> Python-3000 mailing list
> Python-3000 at python.org
> http://mail.python.org/mailman/listinfo/python-3000
> Unsubscribe: http://mail.python.
> org/mailman/options/python-3000/python%40theyoungfamily.co.uk
> 



More information about the Python-3000 mailing list