I\'m a big fan of PHP and it\'s obviously a very weakly-typed language. I realize some of the benefits include the general independence of changing variable types on the fly
Many a book has been written about this sort of thing. There's an inherent tradeoff; with a weakly-typed language a lot of annoyances simply cease to be. For instance, in Python you never have to worry about dividing a float
by an int
; adding an typing functions' arguments (did you know, OCaml has special +. operators for adding int
to a list
;float
s because (+)
sends int
s to int
s!); forgetting that a variable can be null... those sorts of problems simply vanish.
In their place come a whole host of new runtime bugs: Python's [0]*5
gives, wait for it, [0,0,0,0,0]
! OCaml, for all the annoyance of strong typing, catches many many bugs with its compiler; and this is precisely why it's good. It's a tradeoff.