Discussion: new operators for numerical computation

Edward Jason Riedy ejr at lotus.CS.Berkeley.EDU
Wed Jul 26 23:45:47 EDT 2000


And Greg Ewing writes:
 - 
 - It's hard to see how to implement multiple dispatch in a way
 - that preserves this property, while still being flexible
 - enough to solve the kinds of problems that multiple dispatch
 - is supposed to solve.

Assume the generic function route to multiple dispatch.  One name
is declared to be a generic function, then definitions are attached
by declaring methods that implement the function for combinations of
argument types.  These definitions must be loaded from appropriate
modules before they can be bound to the name, which is itself located
within some module.

How is this significantly more painful than the object factory pattern?  
You have one front-end package that provides a factory.  The factory 
can return objects from any package the factory's package has loaded.
The client of the factory need not have imported the back-end module,
so this won't be obvious in the way you seem to prefer.

Of course, both Python and most (all dynamic) languages supporting
generic functions have run-time introspection facilities, so you can
answer these questions then.  Some programming environments can also
help out, although I'm pretty much stuck in Emacs- and vi-land until
someone plops a free software one with compatable key bindings in
front of me.

Jason



More information about the Python-list mailing list