Since Kotlin 1.3 the `fun main(args: Array<String>...
# language-proposals
v
Since Kotlin 1.3 the
fun main(args: Array<String>)
function is permited to be simplified as
fun main()
(when the entry arguments are not used). My suggest is that, when the arguments of the entry
main
function ARE used, the IDE/Compiler may accept just
fun main(args)
, assuming the type of
args
would be
Array<String>
.
14
k
I would rather see this done like Cocoa+Swift, where there is no main method (instead, a main file) and if you want the arguments you call
CommandLine.arguments
https://developer.apple.com/documentation/swift/commandline/2294816-arguments
k
does that mean the CommandLine is a
private val commandLine: CommandLine
in the file?
k
@ki Usage is like:
Copy code
print(Int(CommandLine.arguments) == 42)
@Ruckus Not as far as I know. It's just a nicer syntax on top of what we're already doing. It can even be inlined if you're really concerned, but we're not exactly doing kernel code in Kotlin :P