2 ms·
Depends what operation you are performing. increaseAge function would probably require the object to actually increase the age, not just return an increased age
by Skinney 13y ago
Depends what operation you are performing. increaseAge function would probably require the object to actually increase the age, not just return an increased age value.
This is a poor example, i know, but the point is that while both is simple operations in both static and dynamically typed languages, dynamically typed languages allow you to do this without writing an interface, generic function, abstract base class or whatever and restricting the function to that particular use case.
The tradeoff is flexibility vs safety. I personally prefer dynamically typed languages as I've found that with a combination of discipline and unit-tests (which, IMHO, you should have anyway) I never really miss the static type-checker. But I understand those people who prefer static typing very well.