Reflect.compareMethods vs "=="


#1

I’ve seen different Reflect methods use at OpenFL sources when simple operators could make same job for “cheaper”. For example, Reflect.compareMethods(...). Why not method1 == method2?
Are compareMethods somehow unwrap and make similar “==” to exact compilation target or its because of proper crossplatform code writing?


#2

I believe the issue is Neko, for example (haxeui snippet): https://github.com/haxeui/haxeui-core/blob/master/haxe/ui/util/FunctionArray.hx#L32-L47


#3

Ok, thanks! Do somewhere exist a list of tips for that kind crossplatform dependences? Mean what is better to use/avoid for reliable haxe code for all supported haxe targets?


#4

Reflection in general gets dodgy, so use strongly-typed code when possible. Also, don’t assume that numeric types initialize as zero. Initialize your values before you use them