On 09.03.2018 00:01, Paul King wrote:
But Java doesn't have a dynamic mode so it is difficult to offer the exact same behavior. We could prohibit "var" from being used in dynamic Groovy but users might expect to be able to cut and paste from Java and run in dynamic mode.
I am convinced that is what people expect, at least that was exactly what I did, and what I tell Java developers is so great about Groovy: Just start by pasting/writing Java without semicolons at the end of each line, and learn as you go along. I feel I am missing something here, because where you seem to see problems, in my mind var "just" gets replaced by the RHS type as early as possible - why would this raise any problems in dynamic or static Groovy ?
var x = RHS becoming typeof(RHS) x = RHS gives exactly what any developer who knows var would expect, no ?