Typing system vs. Java

Christian Tanzer tanzer at swing.co.at
Tue Jul 31 10:54:15 EDT 2001


Jonathan Hogg <jonathan at onegoodidea.com> wrote:

> I can though, think of plenty of places where strong static typing would 
> defeat intentional exploitation of the dynamic typing. Maybe this is 
> poor programming on my part, but I can't even think how one would type a 
> function like say:
> 
>    def f(zs): return reduce( lambda x, y: x + y, zs )

Genericity (templates in C++) this is not a problem -- you get one
instance of `f` for each type `zs` you happen to apply `f` to.

Disclaimer: C++ templates don't allow different return types for such
functions, but that's a restriction of C++, not of genericity. IIRC,
Ada generics can be generic in the return type, too.

-- 
Christian Tanzer                                         tanzer at swing.co.at
Glasauergasse 32                                       Tel: +43 1 876 62 36
A-1130 Vienna, Austria                                 Fax: +43 1 877 66 92





More information about the Python-list mailing list