On Wed, Feb 02, 2005 at 01:14:40PM +0000, Angus F. Hewlett wrote: > >The advantage of a dispatcher is you can extend the API by > >adding new opcodes, you don't change the binary interface, > >makes backward/forward compatibilty very easy. > > > > > That's very true. However, it depends on the richness, modularity and > object-ness of the API. > > For instance, if a GMPI Event is expected in some ways to behave like an > object (with get/set methods mediated via the dispatcher), when you > extend the functionality you can end up with a highly > disordered/unsorted list of dispatcher opcodes.. either that or you have > to reserve plenty of space in the opcode enumeration so as to keep like > with like - so that all messages beginning with 0x1000 relate to > initialisation, 0x2000 to pins and connection, 0x3000 to events... The worst part about a dispatcher is that the opcodes become scoped much wider than they need to be, and the data gets farther from the meaning. If I want to address a "method" of the third foo in the bar array of object o, you end up with something like o->dispatch(o, OBJ_BAR_METHOD, 3, args...); which is a lot nastier than o->bar[3]->method(args) ---------------------------------------------------------------------- Generalized Music Plugin Interface (GMPI) public discussion list Participation in this list is contingent upon your abiding by the following rules: Please stay on topic. You are responsible for your own words. Please respect your fellow subscribers. Please do not redistribute anyone else's words without their permission. Archive: //www.freelists.org/archives/gmpi Email gmpi-request@xxxxxxxxxxxxx w/ subject "unsubscribe" to unsubscribe