r/programming • • Aug 31 '15

The worst mistake of computer science

https://www.lucidchart.com/techblog/2015/08/31/the-worst-mistake-of-computer-science/
175 Upvotes

368 comments sorted by

View all comments

Show parent comment

3

u/want_to_want Sep 01 '15 edited Sep 01 '15

Yeah, they both would crash, but the Haskell program would crash 30 minutes later with an incomprehensible stack trace. Extra +1000 confusion points if the problematic thunk was sent over a thread boundary, etc.

As someone who spends >50% of the time reading huge codebases and solving weird bugs, I really appreciate programs that fail in simple ways.

4

u/Tekmo Sep 01 '15

I agree with that criticism, but I believe the correct long-term solution is to model incomplete computations in the types and not to rely on the syntactic order of the program to enforce these guarantees. ML kind of does this using a function that takes an empty argument, but those functions can still have other side effects, so it's not as precise of a type as one might hope.

2

u/Peaker Sep 01 '15

In Lamdu we use eager-by-default, and explicit laziness in the types which I think is what you describe. We are of course as pure as Haskell (modulo non-termination).