I don't understand how groovy typing works. On wikipedia it is written that it has a strong typing, but I can perfectly do that on the interpreter :
1 + '1'
==> 11
So maybe I am confused and I didn't understand what weak typing is, but I'd like to know what this feature is then.
It's not an issue of weakly or strictly typed languages. As delnan show, there is a weary slick theme, and terminology here can be different.
What do you see in interpreter, is a work of overloaded plus operator, which allows you easy concatenate values into strings, very useful feature for printing some output or logging.
To be specific, Groovy is weakly(optionally, as tim suggested) typed, you can define types, or you can omit them, using def
keyword. It also allows you to do a lot of implicit conversions, because of it dynamic nature. More info about types. There are several annotations, allowing you to change that behaviour, like @CompileStatic or @TypeChecked.
In every particular situation, you can get better solution, using right typing strategy. It's very Groovy ;)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With