Skip to content

Immutable capsules usage #44

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

You must be logged in to vote

Where would you call this container.read? If the answer is from within a capsule or RearchConsumer (which will be 99.99% of the time unless you’re making a web server), then no, do not use container.read.

The overhead of use(someCapsule) is negligible and when dependencies are cached it is O(1) (at least in the dart implementation, in Rust it’s O(logn) iirc because of the concurrency model).

In capsules/RearchConsumer, always use(someCapsule). It will ensure you don’t shoot yourself in the foot when things change in the future.

Replies: 1 comment 1 reply

Comment options

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

Answer selected by GregoryConrad
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