structural-typing

    19热度

    2回答

    为什么打印wtf?模式匹配不适用于结构类型吗? "hello" match { case s: { def doesNotExist(i: Int, x: List[_]): Double } => println("wtf?") case _ => println("okie dokie") }

    10热度

    1回答

    我想定义一个结构类型来定义具有“add”方法(例如,一个java集合)的任何集合。利用这一点,我想定义在某集合 object GenericTypes { type GenericCollection[T] = { def add(value: T): java.lang.Boolean} } import GenericTypes._ trait HigherOrderFunc