Haxe 中 类 的类型是什么?

What is the type of classes in Haxe?

我正在尝试找出 Haxe 中此地图的一般密钥类型:

var foo = [
    Foo => new Foo()
];

This is me trying to figure it out via typeof on http://try.haxe.org/,但我无法理解输出的意义。

在我的例子中,我无法推断出这样的类型,必须提前声明它 (Map<ClassOrSomething, Foo>)。

为了回答您的问题,class 的类型是 Class<T> - 例如,Class<Foo>Class<Dynamic> 都适用于您的情况。

但是,classes can't be used as map keys (old issue but to my knowledge this is still the case.) One alternative would be to use string class names for the keys. You can get the class name from the class with Type.getClassName(Foo), and turn the string back into the class with Type.resolveClass. (Haxe Type documentation)