什么是Scala REPL';他在这里告诉我什么?

什么是Scala REPL';他在这里告诉我什么?,scala,read-eval-print-loop,tab-completion,scala-2.9,Scala,Read Eval Print Loop,Tab Completion,Scala 2.9,在阅读Cay S.Horstmann的《不耐烦者的Scala》时,我注意到第一章中的第一个练习揭示了一些有趣的东西 在Scala REPL中,键入3。然后是Tab键。可以采用什么方法 当我这样做的时候,我得到了以下信息 scala> 3. % & * + - / > >= >>

在阅读Cay S.Horstmann的《不耐烦者的Scala》时,我注意到第一章中的第一个练习揭示了一些有趣的东西

  • 在Scala REPL中,键入3。然后是Tab键。可以采用什么方法
  • 当我这样做的时候,我得到了以下信息

    scala> 3. % & * + - / > >= >> >>> ^ asInstanceOf isInstanceOf toByte toChar toDouble toFloat toInt toLong toShort toString unary_+ unary_- unary_~ | scala>3。 % & * + - / >>=>>>>>^A安装 toByte toChar toDouble toFloat toInt的替代物 toLong toShort toString UNIARY_uu+UNIARY_uu-UNIARY_u~ | 但我注意到,若我第二次点击Tab,我会得到一个稍微不同的列表

    scala> 3. != ## % & * + - / >= >> >>> ^ asInstanceOf equals getClass hashCode isInstanceOf toByte toChar toDouble toFloat toInt toLong toShort toString unary_+ unary_- unary_~ | scala>3。 != ## % & * + -/>=>>>>>^A安装 等于getClass hashCode isInstanceOf toByte toChar toDouble toFloat toInt toLong toShort toString 一元字母+一元字母-一元字母
    这里的REPL想告诉我什么?第二次出现的不同方法有什么特别之处吗?

    在REPL中点击两次选项卡:

    如果“methodName”在
    z
    的补全中,并且
    verbosity>0
    指示 tab连续按了两次,然后我们调用
    alternativesFor
    并显示重载方法签名的列表

    来自的以下方法指示当
    详细程度==0
    时(即,当您只点击了一次选项卡,并且没有获得
    版本的替代项时),为方法完成过滤的内容:

    def anyRefMethodsToShow=Set(“isInstanceOf”、“asInstanceOf”、“toString”)
    def EXCLUDENDSWITH:List[String]=Nil
    def excludeStartsWith:列表[字符串]=列表(“
    
    def anyRefMethodsToShow = Set("isInstanceOf", "asInstanceOf", "toString")
    
    def excludeEndsWith: List[String] = Nil
    
    def excludeStartsWith: List[String] = List("<") // <byname>, <repeated>, etc.
    
    def excludeNames: List[String] =
      (anyref.methodNames filterNot anyRefMethodsToShow) :+ "_root_"
    
    def exclude(name: String): Boolean = (
      (name contains "$") ||
      (excludeNames contains name) ||
      (excludeEndsWith exists (name endsWith _)) ||
      (excludeStartsWith exists (name startsWith _))
    )