Keep It Simple, Stupid | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Adding to what Ovid noted above, I think the original post makes a huge mistake in trying to compare dynamic languages to languages with C-style static typing that's been absorbed into many other languages (C++, Java, C#, etc.). When comparing C-style typing to Perl/Ruby/Python/flavor-of-the-month dynamic language, dynamic languages usually win. If we add verboseness to the language (in this case, declaring types), it should give us something in return. The claimed return is speed (compiler has more information to perform optimizations), safety (compiler has more information on what you're trying to do and can see if you're doing something that doesn't make sense, like taking the square root of a string), and self-documentation. These days, the additional speed is better handled by simply throwing hardware at the problem or finding optimizations elsewhere when they're needed. If this were the only argument for C-style typing, then it would rarely be enough to overcome the cost of additional verboseness. The argument for speed was a valid one when Richie and the gang were writing UNIX, but today, hardware is usually cheaper than developer time. The safety argument is outright bunk for this style of typing. Type errors in C are just as likely to be minor annoyances (requiring a typecast, which further increases verboseness) as they are to be real problems. The false-positive rate is high enough that programmers are likely to treat all type errors as annoyances. C++/Java/C# make these problems somewhat less likely, but the type system still gets in your way more than it actually helps. Self-documentation is a weak argument. The additional verboseness is there for the compiler's benefit, not your's. While there might be some benefit here, I can't see it being a replacement for real documentation or good coding practices. Therefore, the arguments for C-style static typing over Perl-style dynamic typing are weak at best, and I can't take people seriously who try to compare these two possibilities. I can take people seriously who compare languages with strong type inferencing systems (Haskell and Ocaml) against dynamic languages. These languages demonstrate the safety value of strong type systems (type errors are almost always real problems), and aren't even particularly more verbose than dynamic languages. People who are still gripping to C-style typing have rarely explored these alternatives. "There is no shame in being self-taught, only in not trying to learn in the first place." -- Atrus, Myst: The Book of D'ni. In reply to Re: Interesting read: "Why I use perl and still hate dynamic language weenies too"
by hardburn
|
|