I love dynamic typing, but…

$a = "look I'm just a string";$b = 0;
if ($a ==$b) { return "come on, really?"; }


This has caused two separate bugs of mine this afternoon, both of which took way too long to find.

“I love dynamic typing, but…”

But, any time it strays from static-typing you are unhappy?

The only power dynamic typing grants you, is the power to write code that won’t work. Surprisingly, thats it!

The set of programs that can be expressed validly in a static system are certainly a subset of programs that can be expressed in a dynamic system. The important thing to keep in mind is this: any program expressed in a statically typed system can be proven to “preserve & progress” (remain internally consistent, and always able to take an evaluation step). So when you subtract this set out of what's expressible in dynamically typed system, you’re really not left with anything useful.