[英]Is this an example of type erasure in Scala?
这是Scala中类型擦除的示例吗?
(None: Option[Int]) == (None: Option[String]) // true
This is the from the scala source: case object None extends Option[Nothing]
这是来自scala来源的:
case object None extends Option[Nothing]
Before erasure both would be None[Nothing]
because only a single instance of None
exists. 在擦除之前,两者都将为
None[Nothing]
因为仅存在一个None
实例。 Yes this is an example of erasure, but not a realy good one. 是的,这是擦除的例子,但不是真正的好例子。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.