Skip to content

Access other capsules from a Side Effect? #33

Closed Answered by GregoryConrad
busslina asked this question in Q&A
Discussion options

You must be logged in to vote

Seems that is not possible to access other capsules from within SideEffectRegistrar.

This was an intentional design decision I made back before ReArch was named ReArch (it was called "Unstate" back then for some trivia). The reason: it completely decouples side effects from capsule state, which is important if you want to test them in isolation or port one or the other elsewhere.

Now, I have to read in the capsule and pass it to the side effect, which is more tedious an repetitive

Something like this is only an extra line of code and still keeps your side effects and capsules completely decoupled:

ResourceManager<FooBar> myResourceCapsule(CapsuleHandle use) {
return use.asResource(
  …

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@GregoryConrad
Comment options

Answer selected by GregoryConrad
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants