[Python-3000] my take on "typeclasses"
Marcin 'Qrczak' Kowalczyk
qrczak at knm.org.pl
Fri May 12 02:01:21 CEST 2006
Talin <talin at acm.org> writes:
> # Use as a function argument constraint
> @generic
> def flatten( x:concepts.iterable ):
> ...
>
> # Another overload
> @generic
> def flatten( x:concepts.associative ):
How are concepts defined?
How is it determined which specialization takes preference when
a function is specialized on several matching concepts?
(With generic functions based on types this is determined by
explicitly declared subtyping.)
> Testing for signatures, how about something like this:
>
> def function( f:concepts.function( concepts.iterable, int ) )
>
> Which describes a function that takes an argument which is
> a function that takes an iterable and an int.
When such concept is called to test the claim against an object,
how does it determine whether the object is a function which takes
an iterable and an int?
--
__("< Marcin Kowalczyk
\__/ qrczak at knm.org.pl
^^ http://qrnik.knm.org.pl/~qrczak/
More information about the Python-3000
mailing list