Making it stick.: The Road to Ruin: Patrick Logan, Smalltalk enthusiast, has been wringing his hands lately over Guido’s plans to make Python an (optionally) more typeful language. It’s been interesting reading. I’m not a big Python programmer but I would tend to agree with Logan. My idea of a good typed language is something like Haskell, with type inference. That’s not the direction this would go, it’d be more like optionally making your Python more C++-like or something.
Hubris alert: there is no way I could reasonably be considered competent enough to make the following judgements. As usual, I do not let that stop me:
I don’t really trust Guido’s judgement. It took Python years to get something close to the level of grooviness present in Ruby from very early stages (well, of course, Ruby had Python to look back on — but it mostly didn’t, it mostly looked back on Smalltalk and Scheme, and of course Perl). My impression is that Python is something of an accidental masterpiece, cool in ways Guido did not originally intend, perhaps for reasons he did not originally understand. There is no reason to assume his guidance will keep it cool any more than Lucas’s guidance kept the Star Wars series on course.
Yes, I’m saying that with type declarations we may be seeing the first of Python’s midichlorians.
On the upside, Guido seems in this post to have a clear understanding of the difference between true subtyping and OO subclassing — and the importance of distinguishing the two (subtypes must satisfy the Liskov substitution principle). There’s a great post by Oleg Kiselyov which demonstrates how C++’s class system isn’t actually very useful for type checking, because it conflates the two — and how you’d have to code C++ to fix it.
On the downside, Xoltar tweaked Guido very devastatingly — Guido had dissed the highly typeful, type-inferring language Haskell, because it tends to use recursion for loops, and Guido thinks that it’s unnatural for humans to think recursively — that we think better in plain loops. And that therefore Haskell would never be as big and important and popular as Python. Or words to that effect. Anyway, Xoltar pointed out that you could define “while” and “foreach” functions in Haskell in less than half a page of code. Lucky for Haskell programmers, huh? They can fix everything that is wrong with their language in no time!