Scala控制台命令来自何处?它们在语法上是什么?

Scala控制台命令来自何处?它们在语法上是什么?,scala,Scala,打开Scala控制台后(只需在终端中运行Scala),就可以调用一组命令,每个命令都以冒号开头: 通过在REPL中键入:help,可以看到这些命令的列表,它本身就是其中之一 scala> :help All commands can be abbreviated, e.g. :he instead of :help. :cp <path> add a jar or directory to the classpath :edit <id>

打开Scala控制台后(只需在终端中运行
Scala
),就可以调用一组命令,每个命令都以冒号开头

通过在REPL中键入
:help
,可以看到这些命令的列表,它本身就是其中之一

scala> :help
All commands can be abbreviated, e.g. :he instead of :help.
:cp <path>               add a jar or directory to the classpath
:edit <id>|<line>        edit history
:help [command]          print this summary or command-specific help
:history [num]           show the history (optional num is commands to show)
:h? <string>             search the history
:imports [name name ...] show import history, identifying sources of names
:implicits [-v]          show the implicits in scope
:javap <path|class>      disassemble a file or class name
:line <id>|<line>        place line(s) at the end of history
:load <path>             interpret lines in a file
:paste [-raw] [path]     enter paste mode or paste a file
:power                   enable power user mode
:quit                    exit the interpreter
:replay                  reset execution and replay all previous commands
:reset                   reset the repl to its initial state, forgetting all session entries
:save <path>             save replayable session to a file
:sh <command line>       run a shell command (result is implicitly => List[String])
:settings [+|-]<options> +enable/-disable flags, set compiler options
:silent                  disable/enable automatic printing of results
:type [-v] <expr>        display the type of an expression without evaluating it
:kind [-v] <expr>        display the kind of expression's type
:warnings                show the suppressed warnings from the most recent line which had any
scala>:帮助
所有命令都可以缩写,例如:he而不是:help。
:cp将jar或目录添加到类路径
:编辑|编辑历史记录
:help[命令]打印此摘要或命令特定的帮助
:history[num]显示历史记录(可选num是要显示的命令)
:h?搜索历史
:imports[名称…]显示导入历史记录,标识名称的来源
:implicits[-v]显示范围中的implicits
:javap反汇编文件或类名
:line |将行放在历史记录的末尾
:在文件中加载解释行
:粘贴[-raw][path]进入粘贴模式或粘贴文件
:电源启用电源用户模式
:退出解释器
:重播重置执行和重播所有以前的命令
:重置将repl重置为其初始状态,忘记所有会话条目
:将可重放会话保存到文件
:sh运行shell命令(结果隐式=>List[String])
:设置[+|-]+启用/-禁用标志,设置编译器选项
:静音禁用/启用结果的自动打印
:type[-v]显示表达式的类型而不计算它
:种类[-v]显示表达式类型的种类
:warnings(警告)显示最近一行中有任何
这些命令是实际的Scala代码还是REPL在将行解释为Scala之前可以识别的任意字符串


如果它们确实属于Scala世界,那么它们在语法上是什么?这些方法只是遵循命名约定吗?

它们是REPL语法的一部分,而不是Scala语法的一部分


从REPL的角度来看,它们在语法上是命令。从Scala的角度来看,它们是语法错误。

它们是REPL语法的一部分,而不是Scala语法的一部分


从REPL的角度来看,它们在语法上是命令。从Scala的角度来看,它们是语法错误。

它们是REPL语法的一部分,而不是Scala语法的一部分


从REPL的角度来看,它们在语法上是命令。从Scala的角度来看,它们是语法错误。

它们是REPL语法的一部分,而不是Scala语法的一部分


从REPL的角度来看,它们在语法上是命令。从Scala的角度来看,它们是语法错误。

据我所知,它们只是repl特定的命令。这里没有特定于scala的方法,据我所知,它们只是特定于repl的命令。这里没有特定于scala的方法,据我所知,它们只是特定于repl的命令。这里没有特定于scala的方法,据我所知,它们只是特定于repl的命令。这里没有特定于scala的方法