Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Research signal-slot library features #138

Open
YarikTH opened this issue Sep 16, 2023 · 0 comments
Open

Research signal-slot library features #138

YarikTH opened this issue Sep 16, 2023 · 0 comments

Comments

@YarikTH
Copy link
Owner

YarikTH commented Sep 16, 2023

observers from ureact have lots of things in common with a classic signal-slot Pattern implemented by boost/signals2, Qt and many other less known libraries (for e.g. KDAB/KDBindings and PG1003/observer).

Unlike ureact's events, signal-slots is not composable. But instead it provides one to many connection between one signal and many slots. Sometimes even backwards connection is possible in a form of collecting results of each slot in a container when signal is emitted. Also, signal-slots can have several args to pass instead of a single one in ureact.

Interesting features I have seen so far:

  • if slot's functor receives less arguments than passed, then it is OK. It can be interesting not only for observer functions, but all other functions too
  • connection can be temporary blocked. It is alive, bun don't call functor until unblocked
  • lifetime tracking of slot's arguments See boost/signals2 tutorial. Looks complex, but it can allow more safe callback execution. It can be done manually inside observer callback though. Special case of such tracking is connection_owner.
  • slots execution ordering. I'm not sure is it required, but it seems that unordered execution of observer callbacks could be a problem in some cases. I don't know should ordering be on per reactive value basis, or on context basis instead.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant