Skip to content

feat: add scope() for hierarchical child scopes#39

Open
jodinathan wants to merge 1 commit into
mintware-de:mainfrom
jodinathan:feat/child-scope
Open

feat: add scope() for hierarchical child scopes#39
jodinathan wants to merge 1 commit into
mintware-de:mainfrom
jodinathan:feat/child-scope

Conversation

@jodinathan

Copy link
Copy Markdown

Adds ServiceContainer.scope(): a child container with its OWN singleton instance cache and a parent reference. Unknown services resolve from the parent (and cache there); scope-local services passed in scope(services:) are cached only in the child, so they never leak to the parent or siblings. has() and resolveByTag() also fall back to the parent. enhance() is untouched.

Adds ServiceContainer.scope(): a child container with its OWN singleton
instance cache and a parent reference. Unknown services resolve from the
parent (and cache there); scope-local services passed in scope(services:)
are cached only in the child, so they never leak to the parent or siblings.
has() and resolveByTag() also fall back to the parent. enhance() is
untouched.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@jodinathan

Copy link
Copy Markdown
Author

@devtronic can you check this PR please

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

Successfully merging this pull request may close these issues.

1 participant