[Later: Still can't figure out if Groovy has static typing (seems that it does not) or if the bytecode generated using explicit typing is different (seems that it is). Anyway, on to the question]
One of the main differences between Groovy and other dynamic languages -- or at least Ruby -- is that you can statically explicitly type variables when you want to.
That said, when should you use static typing in Groovy? Here are some possible answers I can think of:
- Only when there's a performance problem. Statically typed variables are faster in Groovy. (or are they? some questions about this link)
- On public interfaces (methods, fields) for classes, so you get autocomplete. Is this possible/true/totally wrong?
- Never, it just clutters up code and defeats the purpose of using Groovy.
- Yes when your classes will be inherited or used
I'm not just interested in what YOU do but more importantly what you've seen around in projects coded in Groovy. What's the norm?
Note: If this question is somehow wrong or misses some categories of static-dynamic, let me know and I'll fix it.