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

Try allow inputs and transactions from observer callbacks #118

Open
YarikTH opened this issue Mar 5, 2023 · 1 comment
Open

Try allow inputs and transactions from observer callbacks #118

YarikTH opened this issue Mar 5, 2023 · 1 comment

Comments

@YarikTH
Copy link
Owner

YarikTH commented Mar 5, 2023

Description

Note: inputs are: var_signal::set, var_signal::modify, event_stream::emit.

Currently observer callbacks can't add inputs, because transactions is still in progress and current input value are still used, so their modification can ruin propagation process.

Theoretically propagation can be improved to allow it, and maybe it is wanted because library usage would be limited otherwise.

Such feature can allow infinite or finite loops if observer callback touches inputs which it depends on.

@YarikTH
Copy link
Owner Author

YarikTH commented Mar 5, 2023

One of the difficulties is that it turns out that it is necessary to allow changing inputs, although they have not yet been cleaned up after the last transaction.
One of the more or less reasonable options for allowing changes to inputs from observers is enque_transaction. Sometimes lambdas of scheduled transactions will simply be inserted into the queue and it will be possible to execute them in a batch upon completion of the propagate.
Problems are obtained only with observers. But if you somehow postpone their execution to the end and first copy the data that will go to the lambdas, then maybe something will work out.
You may also have to duplicate all the input node data in order to modify future data, but leave the current data unchanged. Which, however, does not fit well with the purpose of introducing modify, since this cannot be done without copying.

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