[Python-Dev] A thought on generic functions (original) (raw)
Neil Toronto ntoronto at cs.byu.edu
Sat May 31 02:23:22 CEST 2008
- Previous message: [Python-Dev] A thought on generic functions
- Next message: [Python-Dev] Iterable String Redux (aka String ABC)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Greg Ewing wrote:
Paul Moore wrote:
I'd rather see a solution which addressed the wider visitor use case (I think I just sprained my back bending over backwards to avoid mentioning generic functions :-)) Speaking of generic functions, while thinking about the recent discussion on proxy objects, it occurred to me that this is something you can do with an OO system that you can't do so easily with a generic function system. If the operations being proxied were generic functions rather than methods, you'd have to override them all individually instead of having a central point to catch them all.
It depends on your dispatch rules. Say the implementation orders the candidates lexically (like default CLOS). This is equivalent to choosing as first candidates the set of functions with the most specific first argument. Resolution for a generic function call and generic method call are semantically the same, so there's no reason not to have the latter, and proxying by getattr tricks becomes doable again.
Neil
- Previous message: [Python-Dev] A thought on generic functions
- Next message: [Python-Dev] Iterable String Redux (aka String ABC)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]