News for hackers. Stuff that matters.
Re:Dynamic Languages are Unmaintainable by lbarrow on Monday July 01, 2013 @08:34AM (#5970143)
I use a strongly, statically typed functional language. Because my code has no mutable state, the type system of the program proves the program correct. So I don't have to write any tests at all and maintenance is easy.
Re:Dynamic Languages are Unmaintainable by colanderman on Monday July 01, 2013 @09:11AM (#5970347)
As someone who uses strongly, statically typed functional languages (dependent ones like Coq no less), and who rarely writes unit tests, I downvoted you because you're wrong. Specifically:

> the type system of the program proves the program correct.

Is not a valid statement, unless you're actually writing proofs in Coq. I bet you aren't.

"The type system of the program proves many simple properties of the program correct" is much more correct.

Also:

> Because my code has no mutable state

No, that's not why. The type system you use may be incapable of reasoning about mutable state, which coincidentally serves to indicate that it most likely can't reason about such things as "this list is sorted", further supporting my initial counterpoint.

Check out ATS or Why for examples of languages that permit reasoning about mutable state.

Re:Dynamic Languages are Unmaintainable by MichaelSalib on Monday July 01, 2013 @08:43AM (#5970186)
Which type system proves program correctness? A good type system can guarantee that your program doesn't suffer from certain classes of errors but that's very very far from correctness. Unless you only write programs that don't have any goal at all besides being memory safe: Behold MemSafe 2.9: it doesn't do anything at all, and most importantly, it doesn't do it in a memory safe way!
Re:Dynamic Languages are Unmaintainable by DanWaterworth on Monday July 01, 2013 @08:50AM (#5970226)
All safe type systems provide proofs that implementations fulfil specifications, but most type systems aren't expressive enough to create interesting specifications. The notable exceptions being type systems in dependently typed languages.
Re:Dynamic Languages are Unmaintainable by gizmo686 on Monday July 01, 2013 @10:07AM (#5970694)
A strong type system can do more than prove memory safety. It can guarantee that their are no unhandled cases, and that data has been properly processed before going into a certain use; however it (generally) cannot guarantee correctness.

I say generally because the Haskell type system (with some extensions) is Turing complete, so you probably code implement a code prover in the type system.

Re:Dynamic Languages are Unmaintainable by PommeDeTerre on Monday July 01, 2013 @08:50AM (#5970230)
Now and then I get to deal with development groups who have built their software systems using a language like Ruby or PHP. Many of them are proud of their extensive automated tests.

They'll brag about how they have 45,000 or more unit tests, for instance. Yet when we actually look at these tests, many of them just end up implementing a half-baked type system.

Even if they don't realize it, or don't want to acknowledge it, users of dynamic languages do want strong, static typing. It is one of the most useful tools there is when it comes to helping detect or avoid various problems. Rather than doing it in a sensible matter, by letting the computer (via a compiler, for example) efficiently do the hard or tedious work, they just choose to do it themselves manually.

Re:Dynamic Languages are Unmaintainable by icebraining on Monday July 01, 2013 @09:18AM (#5970379)
As a Python programmer, I don't mind a type system that's actually useful and doesn't get in my way. Unfortunately, the most popular statically typed languages have shitty type systems. Maybe someday I'll learn Haskell and get a job writing in it, but until then, I'd rather keep my sanity.
Re:Dynamic Languages are Unmaintainable by mcmillion on Monday July 01, 2013 @08:56AM (#5970264)
Not sure if you're trolling or just don't understand what tests are actually supposed to test.
Re:Dynamic Languages are Unmaintainable by DanWaterworth on Monday July 01, 2013 @09:03AM (#5970299)
I'll bite. What are tests supposed to test?
Re:Dynamic Languages are Unmaintainable by icebraining on Monday July 01, 2013 @09:15AM (#5970361)
That the code is doing what you wanted it to do, instead of what you actually wrote?
Re:Dynamic Languages are Unmaintainable by DanWaterworth on Monday July 01, 2013 @11:14AM (#5971164)
Well, they fail miserably then.
Re:Dynamic Languages are Unmaintainable by emiljbs on Monday July 01, 2013 @08:51AM (#5970238)
(define square ((a number)) :out number (+ a 2))

This program is arguably incorrect, even though the types match up and there is no mutable state.

Re:Dynamic Languages are Unmaintainable by doublec on Monday July 01, 2013 @09:19AM (#5970387)
Some languages can detect this at compile time. For example, ATS - a dependently typed language:

   fun square {m:int} (a: int m): int (m*m) = a + 2
This won't compile because in the type we've said the result must be the square of the input. I've written some more about using dependent types [1] and proofs [2,3] for this sort of thing.

The difference between writing proofs and writing tests is subtle though and serve similar purposes. Tests can make you feel confident that things are right but proofs should make you certain of it.

[1] http://bluishcoder.co.nz/2010/09/01/dependent-types-in-ats.h... [2] http://bluishcoder.co.nz/2013/07/01/constructing-proofs-with... [3] http://bluishcoder.co.nz/2012/10/04/implementing-a-stack-wit...

Re:Dynamic Languages are Unmaintainable by lbarrow on Monday July 01, 2013 @09:58AM (#5970635)
The program is correct, but the function name is wrong.
Re:Dynamic Languages are Unmaintainable by angersock on Monday July 01, 2013 @09:39AM (#5970507)

  >> don't have to write any tests at all
That is, until you find out that your state-machine matches incorrectly on an input text file...

  >> maintenance is easy.
...and you are the only person your company can find to maintain your codebase.

You're zero for two, my friend. :(

Re:Dynamic Languages are Unmaintainable by tome on Monday July 01, 2013 @10:54AM (#5971039)
> ...and you are the only person your company can find to maintain your codebase.

Why should this be? Plenty of companies have teams of functional programmers.

Re:Dynamic Languages are Unmaintainable by angersock on Monday July 01, 2013 @12:34PM (#5971720)
Are you in the Valley or New York, by any chance?

No reason.