
On 05/08/2004, at 7:40 PM, MR K P SCHUPKE wrote:
I have a hard time understanding why functional programmers would not want more static typing guarantees, after all they can always use C if they dont like type systems!
Static guarantees are great, but if you have to explicitly change your style of coding to cope with those extra constraints, it can become (very) cumbersome. After all, Java basically does exactly what you're asking for with head/tail: if you were to write a tail method in a List class, you could simply throw a EmptyListException. That's really the same effect as tail in Haskell returning a Maybe: both forms force you to perform error-handling in the calling function. However, I think Java has shown that forcing error-handling on the caller via exceptions is no magic bullet: a lazy programmer will simply catch the exception in an empty catch {} block. It's a human problem, not a technical one. Obviously exceptions, Maybes, monads etc. are useful, but forcing the programmer to Do The Right Thing is nearly impossible. I personally think that using tricks such as type classes to propagate constraints and errors via the type system is a fantastic idea, because then end-programmers have to worry much less about handling errors properly. -- % Andre Pang : trust.in.love.to.save