[swift-evolution] Make UUID conform to RawRepresentable

Ben Rimmington me at benrimmington.com
Tue Jun 21 15:19:37 CDT 2016

> On 21 Jun 2016, at 01:53, Alsey Miller via swift-evolution <swift-evolution at swift.org> wrote:
> I’m the developer of PureSwift/SwiftFoundation on GitHub, and I originally wrote that library after WWDC 2015 because I did not expect Apple to release an Open Source version of Foundation, and also because Foundation in Swift 2.2 was class based, and not struct based. Now in Swift 3 that is all changing (for the better), and I plan to deprecate my library, but there is one semantic that takes advantage of the Swift guidelines that the new Swift 3.0 Foundation in Xcode 8 doesn’t. UUID seems a natural candidate for conforming to RawRepresentable. Please check out the link below, and you can see how it naturally fits.
> https://github.com/PureSwift/SwiftFoundation/blob/develop/Sources/SwiftFoundation/UUID.swift

Your library uses RawRepresentable for String conversion, but LosslessStringConvertible (if SE-0089 is accepted) could also do this.

Then the RawRepresentable.RawValue could be `uuid_t` (equivalent to your ByteValue tuple) instead.

NOTE: <http://thread.gmane.org/gmane.comp.lang.swift.evolution/20879/focus=20965>

-- Ben

More information about the swift-evolution mailing list