ChrisPenner / rasa

Extremely modular text editor built in Haskell
GNU General Public License v3.0
616 stars 42 forks source link

Events vs. exported extension functions #69

Open jameshaydon opened 4 years ago

jameshaydon commented 4 years ago

I have a question about the design of the extension system. Let me just take an example:

The vim extension will call addBottomStatus, which makes it depend on a particular way the views extension works. Furthermore, it means that the vim extension won't interact with some other "status-like" extension the user might have enabled.

Would it not be better for the vim extension to emit an event instead?

I realize that in this particular instance it might have just been a shortcut, the more general question is: when should an extension expose an action rather than listening for events?

Followup question: moving over to events would only partially solve the problem since the event's type would still be defined in the views extension. So I suppose we would also need extensions whose sole purpose is to provide canonical event types for other extensions to use?