我寫斯卡拉什麼是<stable>和<accessor>當做Scalac -Xprint:typer?
object SquareNumbers extends App {
val numbers = List(1,2,3,4,5)
val squares = numbers map (i => i * i)
println (squares)
}
的一點點並通過scalac
運行它,像這樣:
$ scalac -Xprint:typer SquareNumbers.scala
[[syntax trees at end of typer]] // SquareNumbers.scala
package <empty> {
object SquareNumbers extends Object with App {
def <init>(): SquareNumbers.type = {
SquareNumbers.super.<init>();
()
};
private[this] val numbers: List[Int] = immutable.this.List.apply[Int](1, 2, 3, 4, 5);
<stable> <accessor> def numbers: List[Int] = SquareNumbers.this.numbers;
private[this] val squares: List[Int] = SquareNumbers.this.numbers.map[Int, List[Int]](((i: Int) => i.*(i)))(immutable.this.List.canBuildFrom[Int]);
<stable> <accessor> def squares: List[Int] = SquareNumbers.this.squares;
scala.this.Predef.println(SquareNumbers.this.squares)
}
}
我的問題是,什麼是輸出<stable>
和<accessor>
?他們叫什麼(如在,他們有集體名詞),他們做什麼?
在猜測,我會說,意味着他們丘壑,而不是增值經銷商,並表示這是從對象外的調用...