The previous series of posts on the topic of Event Reflexivity each posed a question about what the general shape of the design pattern actually is. Over the following months after the posts I thought about the pattern a lot more and eventually came to the conclusion that a lot of the questions aren't a simple matter of choosing what's correct - the reason these questions are hard to answer is that both options could be correct. What I have here is in fact not a single unclear design pattern, but instead a whole family of possible choices on a design pattern, with different specifics being more useful to specific cases.
The specific design choices that a particular implementation takes should answer such questions as:
- Ordering control: Are subscribers of some named action invoked in a controllable fashion?
- Invocation functions: What kinds of actions or ways of invoking them are actually provided?
- Heirarchial actions: Do the types of actions occupy a simple flat namespace, or is there some heirarchial structure to them? Can a subscriber catch an entire subspace of actions at once?
- Explicit or implicit subscription: Do subscribers have to explicitly list every action (or action subspace) they wish to receive?
- Filterable arguments: Does the implementation offer a built-in way to filter specific values of arguments by some pre-declared pattern?
Perhaps the only real design question for the Event-Reflexive Design Pattern Pattern is to decide on some neat concise language that implementations can use to explain their specific choices on these issues.
Sure, that Design pattern is named FRP (Functional Reflective Programming). Some years ago Microsoft created the "Rx" (Reactive Extensions) library that is an implementation in more imperative languages like Perl, C#, C++ and so on.
ReplyDeleteToday that Rx library was nearly ported to every language. Microsoft itself suport .Net, C++, Ruby, Python and JavaScript, and there exists a lot of ports for other languages too.
In Perl i found Rx.pl (https://github.com/eilara/Rx.pl) but i don't knew how much already was implemented. Anyway nobody worked on it since a year, so could be that it is already dead. But "Rx" is really, really, realllllly awesome!