-
Notifications
You must be signed in to change notification settings - Fork 1
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
Protocol: Guarantee #62
Comments
The only problem is that it duplicates validation checks in debug mode, but I also don't want init(unsafe:). |
Hm. I could require that it only stores its value, adding some abstract capabilities. Alternatively, I can omit that and mark Divider<T> (#58) as a Guarantee. I mean, it's basically a trusted input with some additional data. |
Meh. It's not enough boilerplate to worry about. |
I might want to add this kind of protocol simply to aid prototyping of various trusted input types (#78). It also simplifies testing since derived operations are identical for all types. Something like the following, perhaps? public protocol Guarantee<Value> {
associatedtype Value
@inlinable static func predicate(_ value: borrowing Value) -> Bool
@inlinable init(unsafe value: consuming Value)
@inlinable consuming func payload() -> Value
} |
Trusted inputs have multiple conveniences that can be derived from a simple protocol:
The text was updated successfully, but these errors were encountered: