-
Notifications
You must be signed in to change notification settings - Fork 1
Closed
Labels
brrrsuch code, much wowsuch code, much wow
Milestone
Description
I have some awkward signatures, backed by some awkward assertions. Look at these two:
func _encodeBigEndianTextWhereRadixIsUIntRoot(_ value: inout ANKSigned<Self>, radix: RadixUIntRoot, uppercase: Bool) -> String {
assert(radix.power.isZero)
...
}
func _encodeBigEndianTextWhereRadixIsNotUIntRoot(_ value: inout ANKSigned<Self>, radix: RadixUIntRoot, uppercase: Bool) -> String {
assert(!radix.power.isZero)
...
}But wouldn't a compile-time check be neat? With two new wrapper types, I can reduce it to:
func _encodeBigEndianText(_ value: inout ANKSigned<Self>, radix: RadixUIntRoot.Perfect, uppercase: Bool) -> String {
...
}
func _encodeBigEndianText(_ value: inout ANKSigned<Self>, radix: RadixUIntRoot.Imperfect, uppercase: Bool) -> String {
...
}Metadata
Metadata
Assignees
Labels
brrrsuch code, much wowsuch code, much wow