-
Notifications
You must be signed in to change notification settings - Fork 530
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
Configurable inheritance for IOLocal
#2067
Conversation
localState, | ||
localState.filter(_._1.inherit), |
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.
Any performance concerns? Maybe add a happy-path for an empty local state?
Closing as it seems this has already been discussed/decided at #1393; apologies for not finding it earlier. |
This reverts commit 00a4cc4.
Sorry to close/reopen 🙃 After sleeping on this, I would like to reinstate my original proposal: distinguishing between inheritable and non-inheritable In #1393 (comment) @kubukoz proposed a very general interface for Thus, my rationale is simple: having both inheritable and non-inheritable For example, the concept of a transformation Thanks in advance, and really hope that this can be considered. |
@armanbilge Honestly, I'm not sure I've changed my views too much from what I expressed in my comment. :-) Regarding heritability specifically, note just how common it is to create and throw away fibers. Nearly every parallel-related combinator does this! Fibers are cheap, so we abuse them, and that's okay. The problem is that if you don't have inherited local state, you're going to end up in a really confusing situation where things just don't work the way you expect. Semantics swapping between I also kind of want to hold off on this kind of complexity until we're really forced (by use-cases) to take it on. This change would considerably complicate |
A small change to
IOLocal
that adds an option to disable "inheritance" such that its value is not copied to child fibers. This provides semantics matching aThreadLocal
; the currentIOLocal
implementation is like anInheritableThreadLocal
.** for
InheritableThreadLocal
"the child's value can be made an arbitrary function of the parent's". Any interest in adding this functionality toIOLocal
? Actually, I would find this quite useful.Edit/update: I implemented the full-blown inheritable via an arbitrary transformation
A => A
, but this has the biggest performance implications. Found some discussion at #1393 (comment)