Make UUID conform to RawRepresentable

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.

  Coleman,

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&gt;

-- Ben

···

On 21 Jun 2016, at 01:53, Alsey Miller via swift-evolution <swift-evolution@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

RawRepresentable is often used for open enums imported from c/objc so I am not certain that is the right semantics.

···

Sent from my iPhone

On Jun 21, 2016, at 1:19 PM, Ben Rimmington via swift-evolution <swift-evolution@swift.org> wrote:

On 21 Jun 2016, at 01:53, Alsey Miller via swift-evolution <swift-evolution@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&gt;

-- Ben

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution