Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

MEP22: Does everything have to go through events? #18007

Copy link
Copy link
Open
@anntzer

Description

@anntzer
Issue body actions

In MEP22, many parts of the code communicate with one another through events (in the sense of a CallbackRegistry) instead of straight method calls. For example, whereas the classic toolbar's mouse_move just calls self.set_message(...) to set a message, the call chain in MEP22 is

ToolManager.message_event(...)
-> ToolManager._callbacks.process(Event(...))
-> [find out that ToolContainer.set_message is connected to the event]
-> ToolContainer.set_message(...)

which is deeper split across multiple files, and not even so trivial to search for (some API elements are now strings (event names) instead of functions or classes).

I realize that this is in theory much more flexible (for example, there could just be no listener, or more than one listener), but is it really worth the complexity? Some practical concerns on top of the general complexity: how do we document the event based API? how do we handle deprecations in it? (likely both are solvable problems; it's just that we have a lot of experience and machinery for handling these for function/class-based APIs, not so much for event-based ones.) The alternative, of course, would be to replace some of these events by straight function/method calls.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.