的签名TraversableLike.flatMap
如下:
def flatMap[B, Th](f : (A) => Traversable[B])(implicit bf : CanBuildFrom[Repr, B, Th]) : Th
的签名GenericTraversableTemplate.flatten
是:
def flatten[B](implicit asTraversable : (A) => Traversable[B]) : CC[B]
为什么后一种方法(在我看来flatMap
仅在变压器函数是 的意义上有所不同implicit
)不能定义TraversableLike
为:
def flatten[B, Th](implicit asTraversable: (A) => Traversable[B],
implicit bf : CanBuildFrom[Repr, B, Th]) : Th
有什么理由必须是这种情况吗?