Tuesday, May 18, 2010

About Haskell Static Typing

From time to time I re-read some random chapter of Real World Haskell. Last night I picked chapter two and found this interesting paragraph about static typing:

"A helpful analogy to understand the value of static typing is to look at it as putting pieces into a jigsaw puzzle. In Haskell, if a piece has the wrong shape, it simply won't fit. In a dynamically typed language, all the pieces are 1x1 squares and always fit, so you have to constantly examine the resulting picture and check (through testing) whether it's correct."

This pops in my mind all the is_a* tests that I've seen in PHP code.