Generics 扩展Iterable的Haxe接口

Generics 扩展Iterable的Haxe接口,generics,interface,haxe,Generics,Interface,Haxe,我有一个扩展Iterable(以及其他接口)的接口 接口MyInterface扩展了Iterable{ 公共函数迭代器():迭代器; } 这给了我 MyInterface.hx:1:第1-3行:的类型参数数无效 宜人的 正确的方法是什么?被定义为一个接口,而不是一个接口,因此这无法工作 只需在类中添加一个名为iterator()的函数即可,无需实现或扩展任何内容。这种机制被称为 这里有关于迭代器的更多信息 interface MyInterface extends Iterable { p

我有一个扩展Iterable(以及其他接口)的接口

接口MyInterface扩展了Iterable{
公共函数迭代器():迭代器;
}
这给了我

MyInterface.hx:1:第1-3行:的类型参数数无效 宜人的

正确的方法是什么?

被定义为一个接口,而不是一个
接口,因此这无法工作

只需在类中添加一个名为
iterator()
的函数即可,无需实现或扩展任何内容。这种机制被称为

这里有关于迭代器的更多信息

interface MyInterface extends Iterable {
  public function iterator ():Iterator<Dynamic>;
}