[Python-3000] Generic function PEP won't make it in time
Phillip J. Eby
pje at telecommunity.com
Mon Apr 23 19:54:53 CEST 2007
At 01:37 PM 4/23/2007 -0300, Leonardo Santagada wrote:
>i've thought that the overloading in GF was more for rules like (bar >
>100) and not for diferent types. will both be suported or only the example
>that you gave?
The idea is that it should be possible for third-party implementations to
add support for more sophisticated rules. The base system would support
type annotations on arguments only -- and *maybe* interfaces.
This would be done by implementing the generic function implementation
using generic functions -- something I've already done in
PEAK-Rules. Basically, the dispatch machinery is decoupled from the
mechanism for specifying methods, and if you implement a new dispatcher
(e.g. one supporting rules like "bar>100"), you simply also register
methods with the overloading module's generic functions to support your new
dispatcher. That way, people can use your "rule" objects with @when,
@around, @before, @after, etc., without having to learn anything but how to
create and use other kinds of rules.
>ps: I didn't respond to python-3000 because I was afraid of disturbing
>serious discussions over there.
This is as serious a discussion as any; if you thought of the question,
chances are good that somebody else had this question also. Thus, I'm
cc:ing this back to the list, before any of them decide to ask me, too. :)
More information about the Python-3000
mailing list