E4004

E4004#

特征方法不能有类型参数(不能是多态的)。MoonBit 目前不支持特征定义中的泛型/多态方法。

错误示例:#

trait Stringer {
  stringify[T: Show](Self, T) -> String
}

建议#

考虑使用动态分发而不是泛型:

trait Stringer {
  stringify(Self, &Show) -> String
}