PEP 3107 and stronger typing (note: probably a newbie question)

Bruno Desthuilliers bdesth.quelquechose at free.quelquepart.fr
Thu Jul 5 08:03:13 CEST 2007


Paul Rubin a écrit :
> Bruno Desthuilliers <bdesth.quelquechose at free.quelquepart.fr> writes:
> 
>>Haskell - as other languages using type-inference like OCaml - are in
>>a different category. Yes, I know, don't say it, they are statically
>>typed - but it's mostly structural typing, not declarative
>>typing. Which makes them much more usable IMHO. 
> 
> 
> Some users in fact recommend writing an explicit type signature for
> every Haskell function, which functions sort of like a unit test.

Stop here. explicit type signature == declarative static typing != unit 
test.

> That doesn't bloat the code up noticibly.  The conciseness of those
> languages comes more from polymorphism and convenient ways of writing
> and using higher-order functions, than from type inference.

Type inference is certainly helpful for genericity.

> 
>>Still, static typechecking is not a garantee against runtime
>>errors. Nor against logical errors.
> 
> 
> Right, however the reality is it does seem to prevent a lot of
> surprises.  

I have few "surprises" with typing in Python. Very few. Compared to the 
flexibility and simplicity gained from a dynamism that couldn't work 
with static typing - even using type inference -, I don't see it a such 
a wonderful gain. At least in my day to day work.

> 
>>I'd have to see a concrete use case. And I'd need much more real-world
>>experience with some ML variant, but this is not something I can
>>expect to happen in a near future - it's difficult enough to convince
>>PHBs that Python is fine.
> 
> 
> Monad Reader #7 has an article about some Wall street company using ML:
> 
>   http://www.haskell.org/sitewiki/images/0/03/TMR-Issue7.pdf
> 
> see the article by Yaron Minsky.

Sorry, I don't live near Wall Street !-)



More information about the Python-list mailing list