-1 vote from me We have "def x" and "var x" for non-final variables and we can use just "final x" for a one-time assignable variable. So there is already a sufficiently terse option available.
-----Original Message----- From: mojo2012 <meister.fu...@gmail.com> Sent: Tuesday, April 28, 2020 7:10 AM To: d...@groovy.incubator.apache.org Subject: [VOTE] Add a shorthand "final var" keyword Dear development community, I'm a long time java developer and I'm used to add "final" to my variable definition: final var name = "a" I think the *"var"* keyword (and the old "*def*" keyword) itself helps a lot, but seeing "*var*" and "*final var*" not being aligned properly in code makes me crazy. As we have def and var in groovy, wouldn't it be nice to have a val or let in groovy too, that is just a short form of "final var"? Although personally I would prefer "*val*" I do understand that some people might have problems differentiating "*var*" and "*val*", hence the "*let*". Both *Kotlin* and *Scala* went for the "val" keyword as well - so it might not bee too bad. Anyway I created a JIRA ticket for this: ... The patch as of now contains both the "let" and "val" syntax. I added tests to check if the actual variable is final. Those tests all seem find. But I wasn't able to see "final val" as syntax error (so the test currently fails). I'm looking forward to get some feedback from you (hopefully positive :-)) [ ] +1 Add either val or let as new shortcut for "final def"/"final var" [ ] 0 I don't have a strong opinion about this, but I assume it's ok [ ] -1 I don't like this feature because ...