-
Notifications
You must be signed in to change notification settings - Fork 911
Add a small explanation on why Restore is needed. #563
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
Add a small explanation on why Restore is needed. #563
Conversation
specification/context/context.md
Outdated
This operation is intended to help making sure the correct `Context` | ||
is associated with the caller's current execution unit. Users can | ||
rely on it to identify a wrong call order and emit a signal to warn | ||
users about the broken invariant. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Users can rely on it to identify a wrong call order and emit a signal to warn users about the broken invariant.
Is a bit unclear to me. I'm reading between the lines, but guessing:
Wrong call order means:
because there is a pattern that an attach of a context should be paired with a detach, then someone reading the code will be able to spot the lifetime of the context. In this regard, someone can quickly identify if the context is detached in the wrong location
"emit a signal to warn users about the broken invariant" I'm having a hard time guessing. What signal is emitted? I'm assuming "broken invariant" is referring to the context object.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@toumorokoshi Updated it to make it a little bit clearer: so basically
- The wrong call order: trying the incorrect Context (usually not the current instance)
- Emit a signal: either logging an error or return a value (this is implementation specific).
Let me know ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ping @toumorokoshi
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ping @toumorokoshi Let me me know if this is better now ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the examples actually help the most. But either way good on merging it and not waiting for my very slow feedback :)
@arminru Added a small note on the optional return value of the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! LGTM
Co-Authored-By: Armin Ruech <[email protected]>
* Add a small explanation on why Restore is needed. * Add a small note on the return value. * Clarify more. * Update specification/context/context.md Co-Authored-By: Armin Ruech <[email protected]> Co-authored-by: Armin Ruech <[email protected]> Co-authored-by: Bogdan Drutu <[email protected]>
Fixes #490
cc @toumorokoshi