使用脚本运行Coffeescript Interactive(REPL)

Ken*_*eng 8 interactive coffeescript read-eval-print-loop

在python中,我可以运行脚本并在该脚本的上下文中进入交互模式.这让我搞乱全局变量以及不检查程序状态的东西.

$ python -i hello.py
Run Code Online (Sandbox Code Playgroud)

我可以用Coffeescript做到这一点吗?我尝试过以下方法:

$ coffee -i hello.coffee
Run Code Online (Sandbox Code Playgroud)

不加载hello.coffee.它相当于咖啡-i

$ cat hello.coffee | coffee -i
Run Code Online (Sandbox Code Playgroud)

在REPL中逐行运行脚本,但在EOF之后结束REPL.

Alb*_*ymk 0

我也面临这个问题。@int3 提供的并不能解决这个问题,因为 CoffeeScript 是一种基于缩进的语言。stdin 会逐行传递代码,但 repl 不够智能,无法实现这一点。既然您发布了这个问题,我建议您在CoffeeScript上创建一个问题(功能请求)