If they're planning to add a lot of Python, I hope they're also adding a lot of automated testing apparatus, and project standards requiring comprehensive tests along with code contributions. Automated testing is good for C++ code, too, of course, but for a dynamic language it's essential, if you hope to be able to make structural changes to the code later. Without, it's just too dangerous to change anything.
Posted Jan 14, 2009 22:13 UTC (Wed) by elanthis (subscriber, #6227)
[Link]
So true.
I particularly loved how when I proclaimed a love for static typing to Python fanatics, I was told that Python is so much better because I "don't have to type superfluous argument type names into function definitions." They conveniently leave off the fact that said typing removes the need for a ton of unit tests for each and every caller of said function to ensure they're passing in the right types.
Every single call to every single module has to be tested _in addition_ to the testing of the module's behavior itself. If you aren't testing everything, you're going to get bit in the ass when you use a fully dynamic language for large-scale application development.
It's wholly different scenario than when using such a language for tasks like serving web pages, where the modules have little interaction. In something like a game, every module interacts with almost every other module. Instead of a simple tree of dependees and dependents, you have a huge web. Unit testing all those interactions is a major PITA, and is so much worse in a dynamic language were you have to test all the things the language can't bother to enforce for you.
Python slithers into Wesnoth
Posted Jan 15, 2009 12:51 UTC (Thu) by liljencrantz (subscriber, #28458)
[Link]
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..
Python slithers into Wesnoth
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.
Python slithers into Wesnoth
Posted Jan 18, 2009 12:19 UTC (Sun) by rwmj (guest, #5474)
[Link]
They conveniently leave off the fact that with type inference you don't need to annotate all the
functions.
Such an opportunity to use a decent functional language here, especially since functional languages
are so much better at handling complex data structures.
Python slithers into Wesnoth
Posted Jan 16, 2009 10:31 UTC (Fri) by eru (subscriber, #2753)
[Link]
Automated testing is good for C++ code, too, of course, but for a dynamic language it's essential, if you hope to be able to make structural changes to the code later.
Does "dynamic" equate with runtime type checks? If not, consider the ML family of languages like SML and CAML, where you get the automatic memory management, pointerlessness and nice built-in dynamic data structures, but they still perform static type checking and compilation. In most cases you don't need to declare types for parameters and variables, because the compiler deduces them for you, eliminating the "less to type" argument.
Python slithers into Wesnoth
Posted Jan 16, 2009 18:19 UTC (Fri) by salimma (subscriber, #34460)
[Link]
Ocaml, while impressively fast, does not handle threading very well, as far as I know (and the same is true of most current functional languages).
Moving from C++ to a different language is probably harder than moving from, say, C -- most native-compiling languages have a C FFI but not C++.
Both are not insurmountable -- the first can be solved by using a multi-process design (with pipes and shared memory -- not sure how well SHM works with Ocaml though); the second is probably a deal-breaker. Python is an exception thanks to Boost::Python.
Python slithers into Wesnoth
Posted Jan 17, 2009 10:18 UTC (Sat) by joe_oblivian (guest, #51538)
[Link]
>Ocaml, while impressively fast, does not handle threading very well, as >far as I know (and the same is true of most current functional languages).
Erlang being a notable exception.
Python slithers into Wesnoth
Posted Jan 18, 2009 12:21 UTC (Sun) by rwmj (guest, #5474)
[Link]
No language handles concurrency well (except, maybe Erlang and some very experimental
languages involving transactional memory).
(BTW, shared memory works fine with OCaml - it's even supported by the stdlib).