Exists if you want to use enum abstracts (enumerations at compile time, but at runtime of a different type):
@:enum
abstract AnEnum(Int)
{
var A = 1;
var B = 2;
var C = 3;
}
class Test3
{
static function main()
{
nowItWorks();
}
static function nowItWorks(?param=AnEnum.A)
{
trace(param);
}
}
There is nothing special about the values โโthat I selected, and you can choose a different type (string or a more complex type) if it suits your use case better. You can treat them the same way as regular enumerations (for switch statements, etc.), but note that when you trace it at runtime, you will get "1", not "A".
: http://haxe.org/manual/types-abstract-enum.html