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

Remove the Evaluator and Validator state from Specifications. #417

Closed
Tracked by #427
fiseni opened this issue Nov 9, 2024 · 0 comments · Fixed by #441
Closed
Tracked by #427

Remove the Evaluator and Validator state from Specifications. #417

fiseni opened this issue Nov 9, 2024 · 0 comments · Fixed by #441
Assignees

Comments

@fiseni
Copy link
Collaborator

fiseni commented Nov 9, 2024

The specifications were designed to be flexible and extendable. The users may choose to replace evaluators, write their extensions, and so on. In reality, 95% of the users do not do that, and they should not pay the price of this "extensibility".

The theme of version 9 is to reduce the allocation as much as possible. In that context, the specifications no longer accept custom implementations of IInMemorySpecificationEvaluator and ISpecificationValidator as constructor arguments. Instead of keeping these implementation references as a state (and wasting 16 bytes), they will be defined as calculated properties. Our default implementations are singleton instances anyway, and we won't have additional allocations on access. Anyhow, the properties will be defined as virtual, and users will still be able to alter the behavior and use their implementations if necessary.

Breaking changes:
The common use of this library will remain unchanged. Folks who use custom in-memory evaluators or validators will need to change the way they wire them up.

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 a pull request may close this issue.

1 participant