Skip to content
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

Make compiled container (almost) idempotent #686

Merged

Conversation

diesse
Copy link
Contributor

@diesse diesse commented Oct 2, 2019

Using a progressive counter for mapped methods/sub entries, container recompilation produces always the same result if definitions do not change.
It's not fully idempotent because changing definitions order leads to a different container, even if functionally unchanged.
Partially fixes #604

Using a progressive counter for mapped methods/sub entries, container recompilation produces always the same result if definitions do not change.
It's not fully idempotent because changing definitions order leads to a different container, even if functionally unchanged.
@holtkamp
Copy link
Contributor

holtkamp commented Oct 2, 2019

Nice idea 😸

Copy link
Member

@mnapoli mnapoli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I love this! That's really clever and simple ❤️

Would you all agree that it solves the original problem? I understand that if the definition order changes then the compiled container changes, but that's not really a problem for deployment/scaling an application.

src/Compiler/Compiler.php Show resolved Hide resolved
src/Compiler/Compiler.php Show resolved Hide resolved
src/Compiler/Compiler.php Outdated Show resolved Hide resolved
@mnapoli
Copy link
Member

mnapoli commented Oct 21, 2019

Thanks @diesse!

Let's give this a go in a new release!

@mnapoli mnapoli merged commit a6c813b into PHP-DI:master Oct 21, 2019
@diesse diesse deleted the diesse-almost-idempotent-compiled-container branch October 21, 2019 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make CompiledContainer idempotent?
3 participants