Closed codic12 closed 4 years ago
Can you make a PR?
I do not know where in the code this is located. But for reference kotlin goes thru a compilation step. Assuming you have hello.kt:
kotlinc hello.kt -include-runtime -d hello.jar # compile hello.kt to a jar file
java -jar hello.jar # run the jar file the same way as a java generated jar
Kotlin is a compiled language like C or rust, however the Kotlin compiler, kotlinc
, can work like an interpreter using the -script
command line option. To use the Kotlin language this way, you will need to change the file extension to .kts
and use the following shebang line.
#!/usr/bin/env -S kotlinc -script
One of the differences to normally compiling Kotlin is that this way your code's entry point will be the top of the .kts
file, rather than the main
function. This is probably one of the reasons for having a different file extension.
I am aware of this
@gsbhasin123 I don't believe there is any reason why we would not accept a PR to fix this, so can you propose something?
Is at least the first place you'd need to modify.
oh. Well all those languages are interpreted, so I'm not sure how I'd do it for a language that needs two commands (aka a compiled one)
Make a wrapper?
I'm not sure how. Anyways, I moved away from script-runner temporarily because of the lack of input support.
Ok.
I know that I can use a shebang... but then it won't be compatible with normal kotlin :(