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

Experimental predicate wrappers #99

Merged
merged 8 commits into from
Oct 7, 2023

Conversation

oscbyspro
Copy link
Owner

I'm adding some property wrappers, for internal use only (#98). The idea is to move preconditions out of method bodies, resulting in fewer "assuming(_:)" signatures. Additionally, I can use them to branch algorithms through type overloading.

- Zero
- NonZero
- ZeroOrLess
- ZeroOrMore
- LessThanZero
- MoreThanZero
- PowerOf2
- NonPowerOf2
/// A predicate that can be referenced by the type system.
protocol _NBKPredicate<Value> { ... }

/// A property wrapper that validates some predicate on creation.
@propertyWrapper struct _NBKGuarantee<Predicate: _NBKPredicate> { }

@oscbyspro oscbyspro added the brrr such code, much wow label Oct 7, 2023
@oscbyspro oscbyspro added this to the v0.14.0 milestone Oct 7, 2023
@oscbyspro oscbyspro merged commit a56d739 into dev Oct 7, 2023
@oscbyspro oscbyspro deleted the feature/experimental-predicate-wrapper branch October 7, 2023 15:17
@oscbyspro oscbyspro changed the title Feature/experimental-predicate-wrapper Experimental predicate wrappers Oct 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
brrr such code, much wow
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant