how to write a generic compare function in Haxe (haxe3)
I am trying to write a generic compare function (like the c strcmp) in Haxe3 for a template type A, assuming that this template type has a less-than-or-equal-to operator "<=". I saw in the Haxe3 documentation ( http://haxe.org/manual/haxe3/features ) that you can do a similar job if you want to assume that a template type has the new function: @:generic static function foo<T:{function new(s:String):Void;}>(t:T) { trace(Type.typeof(t)); // TClass([class String]) / TClass([class Template]) return new T("foo"); } So, I tried the same technique with a "le" function: class Main { @:generic static