https://kotlinlang.org logo
#announcements
Title
# announcements
a

amorenew

06/13/2017, 5:59 PM
I have questions on Kotlin Features Survey 1-Static members in Kotlin classes #17 why people doesn't want it? 2-Optional (trailing) commas #11 what is this feature? 3-Collection comprehensions #7 what is this feature?
d

dalexander

06/13/2017, 6:02 PM
amorenew: 1) For me,
object
fills the same role. I wouldn’t really want both (although I didn’t participate in the survey). If someone wants static for jvm interop there’s
@JvmStatic
2) Trailing commas in lists would be legal, ie.
listOf(1, 2, 3,)
would compile, currently it doesn’t, mostly I think this is useful during code generation. There’s also another feature that’s alluded to, but I’m not sure what that was. 3) https://en.wikipedia.org/wiki/List_comprehension another syntax for loops.
👏 1
w

wasyl

06/13/2017, 6:03 PM
amorenew: ad. 2 you can e.g. have constructor parameters, each in new line, and last one would have a comma after it as well. I’d like it because you can then rearrange things without having to add/remove comma if you move the last element, and you see 1 line changed in VCS if you add an element to such list
👏 1
m

msink

06/13/2017, 6:12 PM
constructor( arg1: Int , arg2: Int , arg3: Int ) {
👍 1
👎 1
a

agomez

06/13/2017, 6:12 PM
or rearrenge using idea change signature refactor
w

wasyl

06/13/2017, 6:13 PM
@msink this moves the problem to moving the first element, still 😉
and @agomez just using move line is way faster than any refactoring. The feature is there in Groovy, and I really like it for my Gradle scripts
a

agomez

06/13/2017, 6:14 PM
yes, but if you invoke it from somewhere not using named params you'll break your code
b

bashor

06/13/2017, 6:16 PM
@amorenew you can read about all features here https://drive.google.com/file/d/0BwAovUlww0CmVmNQTXd4TTdKYUU/view
👏 1
p

poohbar

06/13/2017, 6:44 PM
Lucas, well moving the line does not search for usages. So you migh as well use the "move argument" function in IntelliJ. Try it: `ctrl`+`alt`+`shift`+`→`