Neko fails to remove function entry in array

13 views
Skip to first unread message

Samuel Batista

unread,
Jan 27, 2013, 3:00:31 AM1/27/13
to haxe...@googlegroups.com
This code works on Flash and CPP targets, but fails on Neko. Seems like function (delegates) comparison doesn't work.

private static var delegates:Array< Dynamic -> Void > = new Array< Dynamic -> Void >();

public static function removeDelegate(eventHandler:Dynamic -> Void) : Void
{
 
if (handlers != null && handlers.length > 0)

 handlers
.remove(eventHandler);

}

Juraj Kirchheim

unread,
Jan 27, 2013, 5:36:08 AM1/27/13
to haxe...@googlegroups.com
I'm confused. The array is called delegates and then referred to as handlers.

But assuming that's not the source of the probem, this is most likely due to method closures not being unique (for the same object and method) and you will need Reflect.compareMethods for comparison. 

I would point out there are several Haxe libraries for events/signals that already work around this limitation ;)

Regards,
Juraj
Reply all
Reply to author
Forward
0 new messages