[Cython] Julialang

Greg Ewing greg.ewing at canterbury.ac.nz
Tue Apr 24 08:29:18 CEST 2012


Dag Sverre Seljebotn wrote:

> Well, there's still the namespace of the argument type. I think it is 
> really a syntactic rewrite of
> 
> obj->foo(bar)
> 
> to
> 
> foo(obj, bar)

This is where I disagree. It's *not* just a syntactic rewrite,
it's a lot more than that.

With a Python method, I have a fairly good idea of where to
start looking for a definition, documentation, etc. Or if it's
a stand-alone function, I can follow the imports and find out
which module it's defined in.

But with generic functions, the implementation for the particular
combination of argument types concerned could be *anywhere*, even
in a file that I haven't explicitly imported myself. It's
monkeypatching on steroids.

I acknowledge that multiple dispatch is very powerful and lets
you do all sorts of wonderful things. But that power comes at
the expense of some features that I particularly value about
Python's namespace system.

> And in Python there's all sorts of problems with who wins the battle 
> over __add__ and __radd__

I think Python's solution to this is rather good, actually. It
seems to work quite well in practice.

And multiple dispatch systems have all the same problems when
the "best" match to the argument types is ambiguous, so it's
not as if multimethods are a magic solution to this.

-- 
Greg


More information about the cython-devel mailing list