[pacman-dev] [PATCH v2 3/7] Update the event callback

Simon Gomizelj simongmzlj at gmail.com
Wed Jan 15 11:02:48 EST 2014


I'm not the biggest fan how the casting is working here. We have various
different structures we can send through now but they all need to be cast
down and then manually cast back up. I think I'd rather have the base
structure done as union then.

But if we're going this far, why now consider going a little farther with
this.

The transaction events are handled in a loop but don't seem to require
anything from the context of the loop. So there is no reason that they
can't be reimplemented as callbacks.

And instead of having one callback function which does everything, we can
introduce one for each of kind of event. The transaction can be seeded with
a structure pointing to all the various callbacks. Then we start treating a
transaction like an event loop.

This would improve type safety since we don't have to cast anything
anymore. This would improve readability since we don't have to rely on
casts and heavy switch statements.

Just an idea. Back on topic, I do like this change.


More information about the pacman-dev mailing list