I've written a tiny bit of Scala
object SquareNumbers extends App {
val numbers = List(1,2,3,4,5)
val squares = numbers map (i => i * i)
println (squares)
}
And run it through scalac
as so:
$ 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)
}
}
My question is, what are <stable>
and <accessor>
in the output? What are they called (as in, do they have a collective noun), and what do they do?
At a guess, I'd say that meant they were vals instead of vars, and mean that it was a callable from outside of the object...