/// A property wrapper that stores an arbitrary type while erasing its value
/// from consideration as part of equaltity, much like `Array.capacity`.
@propertyWrapper
struct Incidental<T>: Hashable {
var wrappedValue: T
static func == (_:Self, _:Self) -> Bool { true }
func hash(into _: inout Hasher) { }
}
Now if I want to make an immutable incidental value, I have to build ImmutableIncidental. It's a wonderful property of Swift that we don't generally end up with Foo and MutableFoo types, but here that property breaks down. I think there's sort of an implicit assumption that wrapped properties are “pointer-like,” but this one is not.
Additional Detail from JIRA
| | | |------------------|-----------------| |Votes | 0 | |Component/s | | |Labels | Bug | |Assignee | None | |Priority | Medium | md5: 9174fa57d73b8e794f0cabbdb6ab7f77Issue Description:
Consider this}}
Now if I want to make an immutable incidental value, I have to build
ImmutableIncidental
. It's a wonderful property of Swift that we don't generally end up withFoo
andMutableFoo
types, but here that property breaks down. I think there's sort of an implicit assumption that wrapped properties are “pointer-like,” but this one is not.