[xinf] Events counter-proposal

Mark Winterhalder mark13 at gmail.com
Sun Jul 9 17:03:21 CEST 2006


I like it!

The bit I don't like about it (or maybe I'm just missing something?),
is the stopping of the propagation:

	public function dispatchEvent<T>( e : Event<T> ) :Void {
		var l:List<Dynamic->Void> = listeners.get( e.type.toString() );
		if( l != null ) {
			for( h in l ) {
				h(e);
				if( e.stopped ) return;
			}
		}
	}

First of all, has for..in a fixed order in haXe? I always assumed the
order to be random.
Then, why should one event be allowed to stop the event from being
delivered to other subscribers? I know this is because of the
bubbling, but I'd solve the bubbling by calling something like
parent.onEvent( event ) inside a handler.
Maybe this is perfectly OK, though, and I don't see it because I never
needed bubbling events before. It just gives me a weired feeling,
which is of course no proper argument against it, and if
EventDispatcher is only an interface it doesn't matter anyway.

> i wasn't too serious :). Nicolas is probably a genius, but you should never get too religious about programming languages (or operating systems) ;)

Oh, come on! I don't have another religion, don't take that away from me! :)

Mark


More information about the xinf mailing list