On 16/01/14 02:02, Simon Gomizelj wrote: > 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.
I'm missing what you mean by this? What loop? > 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. The disadvantage of requiring a callback for each event type is that it requires a callback for each event type... At the moment, a new frontend can just start providing a dummy event callback function and gradually deal with the callbacks rather than having to provide many functions immediately. > Just an idea. Back on topic, I do like this change.
