是scala.Singleton纯编译小说吗?

soc*_*soc 7 singleton types specifications scala language-design

Scala语言规范下§3.2.1说:

稳定类型是单例类型或声明为特征scala.Singleton的子类型的类型.

scala.Singleton在源代码,ScalaDoc和二进制jar文件中都找不到.

尝试REPL导致:

scala> class Foo extends Singleton
<console>:9: error: illegal inheritance from final trait Singleton
       class Foo extends Singleton
                         ^
<console>:9: error: illegal inheritance; superclass Any
 is not a subclass of the superclass Object
 of the mixin trait ScalaObject
       class Foo extends Singleton
                 ^
Run Code Online (Sandbox Code Playgroud)

scala.Singelton生活在哪里,它的目的是什么?

ont*_*ia_ 9

终于找到了一些东西:

Singleton类型本质上是一个带有值的存在的编码技巧.即

T forSome { val x: T } 
Run Code Online (Sandbox Code Playgroud)

变成了

[x.type := X] T forSome { type X <:T with Singleton } 
Run Code Online (Sandbox Code Playgroud)

资料来源:http://scala-programming-language.1934581.n4.nabble.com/scala-Singleton-td1940630.html