[Python-3000] PEP 3124 - Overloading, Generic Functions, Interfaces, etc.

Nick Coghlan ncoghlan at gmail.com
Sat May 12 10:13:33 CEST 2007


Greg Ewing wrote:
> Phillip J. Eby wrote:
>> you can register your types with other people's 
>> generic functions, or other people's types with your generic 
>> functions,
> 
> There's still a possibility of conflict even then. Fred
> registers one of Mary's types with his generic function,
> which he feels entitled to do because he owns the function.
> Meanwhile, Mary registers the same type with the same
> function, which she feels entitled to do because she
> owns the type.
> 
> The problem is that nobody entirely owns the (type,
> function) pair, which is what's required to be unique.

However, even if it *does* happen, the application programmer can still 
resolve the conflict by picking one of the two implementations and 
registering it as an override.

At the moment if you don't like the way a particularly library handles 
another library's or your application's types your ability to do 
anything about it is pretty close to nonexistent (unless the library 
employs some kind of interface or generic function mechanism).

Generic functions don't magically make library compatibility problems go 
away, particularly when the libraries involved are interacting directly 
rather than going through the main application. What they *do* provide 
is a standard toolkit for reducing the likelihood of incompatibility 
occurring in the first place, and providing the means for resolving 
whatever conflicts do arise.

Regards,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
---------------------------------------------------------------
             http://www.boredomandlaziness.org


More information about the Python-3000 mailing list