oscbyspro / AwesomeNumbersKit

Large number arithmetic in Swift
Apache License 2.0
7 stars 1 forks source link

No `Words` #96

Closed oscbyspro closed 1 year ago

oscbyspro commented 1 year ago

This one's a bit though because ANKWords looks somewhat useful from afar, but I believe it can be cut after a closer look at it (#89). The reason it was added was to type-erase ANKFullWidth.Words. I realize now, however, that /words is unlikely to be used non-generically, since ANKFullWidth is itself an equivalent collection. At some point I added the 0 ..< count index constraint, but in the one place where I thought it would come in handy I ended up using a suffixing subsequence instead. Furthermore, ANKWords should conform to Sendable, which means that it cannot constrain pointer algorithms. It's not completely useless, but I don't think it warrants a spot on the-list-of-things-I-need-to-understand-to-use-this-package.

oscbyspro commented 1 year ago

Tangentially, here's a cool idea I've had (, listen or hire me!). Wouldn't it be awesome if associated type constraints could also be used as opaque type constraints? Then I could just add requirements to ANKBinaryInteger.Words and type-erase conforming types as follows:

var words: some ANKBinaryInteger.Words { ... }