True enough. I've tried to explain to dynamic typing lovers that static typing is just a special, very powerful meta-language used for creating unit tests that perform input validation. Very useful that; especially how you annotate the code itself with these little unit tests.
On the other hand, Python does have some nice features like lambdas, continuations, etc..
Posted Jan 15, 2009 15:25 UTC (Thu) by lysse (guest, #3190)
[Link]
Funnily enough, I'm a preferrer of dynamic typing who got shouted at by fans of static typing for saying more or less the same thing... oh well.
Python slithers into Wesnoth
Posted Jan 15, 2009 18:21 UTC (Thu) by cyd (subscriber, #4153)
[Link]
When programming with a dynamical language, you can simply check the type of the argument in the function body, which gives you most of the advantages of type checking (albeit at run-time). The main advantage of dynamic typing, in my mind, is not that you don't have to enter the type of the argument in a function definition. It's that you can write functions that explicitly accept arguments that can be of several possible (carefully specified) types, without messing around with kludges like class inheritance.
Python slithers into Wesnoth
Posted Jan 15, 2009 21:35 UTC (Thu) by njs (subscriber, #40338)
[Link]
>It's that you can write functions that explicitly accept arguments that can be of several possible (carefully specified) types, without messing around with kludges like class inheritance.
NB, every statically typed language more recent than C allows for this. (Even C++, via overloading and templates, and C++ is way behind the state of the art in static type systems.)
Python slithers into Wesnoth
Posted Jan 15, 2009 22:00 UTC (Thu) by boudewijn (subscriber, #14185)
[Link]
Aw, and that already was a pretty polite and respectful discussion,
especially compared to some others...
Python slithers into Wesnoth
Posted Jan 15, 2009 22:58 UTC (Thu) by njs (subscriber, #40338)
[Link]
I've read your comment several times, and maybe I'm just being slow today, but I can't figure out what you're implying :-). (Was that intending criticism, compliment, random observation, posted in the wrong place...? I'm lost!)
Python slithers into Wesnoth
Posted Jan 16, 2009 16:01 UTC (Fri) by boudewijn (subscriber, #14185)
[Link]
I thought the qt is lgpl discussion on lwn was pretty respectful and flamefree compared to some
other discussions I've read recently.
Python slithers into Wesnoth
Posted Jan 16, 2009 8:14 UTC (Fri) by liljencrantz (subscriber, #28458)
[Link]
Sure it's possible to type check in dynamically typed languages, but but statically typed languages offer a much more compact syntax to do the same thing, so it's much more convenient to do it there. And doing it at compile time is a distinct advantage as well, since it means that even code paths like esoteric error handlers that are extremely rarely run, still get at least some checking.
As to duck typing, it's very convenient sometimes, sure. But as another poster said, many modern statically typed languages support it as well. And quite frankly, it's really easy to mess duck typing up, so I'd much rather do it in a language where it's easy to check that the supplied types are reasonably suitable for the task at compile time.