kscript icon indicating copy to clipboard operation
kscript copied to clipboard

kscript --interactive does not resolve the variables defined inside .kts file

Open namiq-tahmazli-epam opened this issue 2 years ago • 1 comments

I am trying to repl connect to .kts file which is defined such

#!/usr/bin/env kscript

val myName = "Namig"

and it can not resolve it. Here is the logs:

kscript --interactive test.kts [kscript] Creating REPL Welcome to Kotlin version 1.8.21 (JRE 11.0.12+0) Type :help for help, :quit for quit println(myName) error: unresolved reference: myName println(myName)

I am thankful in advance for your efforts and creating such a beautiful project which makes my life easier when writing script.

namiq-tahmazli-epam avatar Jun 06 '23 07:06 namiq-tahmazli-epam

I don't know if-- interactive mode was ever intended to resolve pieces of the code in the script. In my understanding, it is only for resolving dependencies and putting them into the scope of REPL. That functionality definitely works:

obraz

(code based on the example from README)

aartiPl avatar Jun 13 '23 19:06 aartiPl