[Python-ideas] Improving the expressivity of function annotations (getting off-topic?)

Mike Meyer mwm at mired.org
Mon Apr 4 22:33:46 CEST 2011


On Mon, 4 Apr 2011 20:47:45 +0100
Michael Foord <fuzzyman at gmail.com> wrote:
> I wasn't entirely joking, and no a dynamic type system doesn't make types
> themselves redundant - just the declaration of them all over the place (and
> often multiple times for the same use in languages like Java and C#).

A good implementation of static types will do that for you as well.

> Generics are a hack within the language syntax to tell the compiler that
> different types *might* be used (and allow you to refer to these types in
> your implementation without knowing what they will be), whereas a smarter
> compiler could deduce this for itself anyway.

Generics (in the named languages) feel like a hack because, well, they
were hacked onto a type system (inherited from C) that didn't allow
for such things. If you design your type system ab initio expecting
that you're going to allow different types to appear in some places -
so long as they satisfy the appropriate conditions - then what you
have may look like generics, but they aren't such hacks. It doesn't
matter whether the type system is dynamic (conditions checked at run
time) or static (conditions checked at compile time).

     <mike
-- 
Mike Meyer <mwm at mired.org>		http://www.mired.org/consulting.html
Independent Software developer/SCM consultant, email for more information.

O< ascii ribbon campaign - stop html mail - www.asciiribbon.org



More information about the Python-ideas mailing list