Something itches me from this discussion.

I somehow find myself with Glenn:
- should Bloc work with other than SDL/OSWindow?
- should SDL/OSWindow work with other than Bloc?

Merging the event hierarchy may prevent these two scenarios. And these scenarios are not only really possible: this is what the current scenario is. On one hand SDL and OSWindow work today with Morphic besides Block. On the other hand Bloc is, after all, an external library loaded on top of Pharo.

To explain better what I think:

- First I have the feeling that BIEvent and OSEvent are not the same thing. They have the same *NAME*. But they model different concepts. What is an event in bloc does not make sense in OSWindow and vice-versa. Why? because OSWindow does not manage widgets nor interactions between them.

- Second, I think that this idea of merging these hierarchies means merging layers also, what leads also to our monolithic system. I agree that this may impose some maintenance burden because there is the maintenance of the two layers plus their mapping (e.g., between the low-level events and the high-level events). But otherwise we are tampering the modularity.

Now, I liked more the suggestion of making Bloc using SDLEvents directly.

But then, wasn't it an idea behind OSWindow that users of OSWindow should be somehow abstracted from the backend behind. And SDL be just a backend? Something like Athens and Cairo.

Is SDL meant to work alone or be just a backend for OSWindow? Because if the case is the later, then maybe it makes sense to do the inverse: SDL should generate directly OSEvents and we should not have SDLEvent.

And going even further: Is OSWindow used in isolation? e.g., without morphic or bloc.

Because then, it the problem is the runtime overhead OSWindow should maybe not reify its events but propose a low level event handler mechanism where we could have

MorphicOSWindowEventHandler
  >> keyEvent: ...
  >> mouseEvent: ...

BlocOSWindowEventHandler
  >> keyEvent: ...
  >> mouseEvent: ...

And each framework generates its own events from low level SDL data. No event transformations, less duplications, and both Bloc and Morphic are plugged on top of OSWindow but not really strongly coupled to it.

-------- Original Message --------



Le 26/10/16 à 20:40, Denis Kudriashov a écrit :

2016-10-26 19:45 GMT+02:00 Glenn Cavarlé <glenn.cava...@gmail.com <mailto:glenn.cava...@gmail.com>>:


    Yes, your are right.
    What i mean is that it could be interesting if:
    [ SDLEvent => BlEvent ]   is substantially faster than   [
    SDLEvent =>
    OSEvent => BlEvent ].
    If the difference is not significant, i think that does not
    justify to not
    benefit from OSWindow abstractions even if sometime they bring
    nothing more.


If you already thought about Announcements performance and produce optimized alternative then I think it is critical to get events fast.
Now we have 10 variables which are decoded from int by bit operations:

    leftShift rightShift leftAlt rightAlt leftCtrl rightCtrl leftCmd
    rightCmd capsLock numLock

And then Bloc encodes them back to int. So for any event we have 20 operations and it is not just primitive calls. Also OSEvent creation produces own garbage for internal structures which also take time and memory.

But for me most important is how maintain both hierarchies. You answer Stef that nothing will change over events during years (nobody invent new one or not often). But such argument could never be valid. Code is used, it could has bugs, it could be improved by itself. People will always need to work with this code, at least to read it. And it is difficult with two hierarchies which are managed by double dispatch. Try to follow how concrete BlEvent is produced.

And there is already some problem. I investigated deeply what happens in sdl about modifiers and buttons. It is not easy. But I see that some information becomes lost. And Bloc also not provides full information from original objects (modifiers and buttons). So to fix these issues one needs to modify both hierarchies. First he needs to decide how decode modifiers from SDL and then how to encode them into Bloc bits. And I am sure new issues will be found again and again. It is normal process.

So denis you suggest that Bloc uses directly SDLEvents.
This would make sense from your analysis.




Reply via email to