Mon, 28 Sep 2009 22:33:26 +0000, language_fan thusly wrote: > Value types can be incorrectly initialized and nobody notices. E.g. > > int min; > > foreach(int value; list) > if (value < min) min = value;
> Now I can tell you, in functional languages there is no other way. All > initializations have to be correct, they are final, they are constants > and they can be initialized incorrectly. But there are some tools that > help in this. Functions can be automatically tested. Invariants, pre- > and post-conditions can be set. Still, I can even bet they are much > safer than D in every possible way. How is this possible? For instance if I use the example given above, I write it like this in a functional language: find_min:: Ord a => [a] -> Maybe a find_min [] = Nothing find_min (h:t) = Just $ foldl min h t You can then use quickcheck to verify the result in some fancy way. I just cannot think of any way how you could crash programs written in this way. They are solid as a rock.
