This message was deleted.
# getting-started
s
This message was deleted.
r
The first is idiomatic
Also, how often are you planning to call
main
explicitly?
I mean how often are you calling
main
directly from Kotlin code
That's the only time when allowing or disallowing varargs would affect it
If you want to you can, but I'd recommend sticking with the idiomatic form
np
s
@randomcat why is it idiomatic?
r
The idiomatic way to write it in Java is
public static void main(String[] args)
.
fun main(args: Array<String>)
is the direct translation of that into Kotlin. It's also how the docs define
main
https://play.kotlinlang.org/byExample/01_introduction/01_Hello%20world
s
ah but that’s not Kotlin tho
r
So? Kotlin has its roots in Java
Idioms from there can sometimes carry over
s
For sure, I just wanna know what you think is more idiomatic about this one language feature instead of this other language feature
r
I'm not deciding what is idiomatic, I'm just saying what it the more common version
s
That seems different from saying “X is idiomatic [and therefore, Y is not]“, doesn’t it?
r
I mean I was taking "idiomatic" to mean commonly used and accepted
I think the first form is by far more common than the varargs form
s
Definitely more common, agreed
a
It also makes searching for main easier for people who are new to your project
s
I would say
Array
is much easier to understand that vararg. "Hey it's an array of arguments" Vs "Hey it's vararg? Hmm whats the type of it? Is it list? Array? Never mind, at least it says several args, so an Iterable, aha!"