Should UUID conform to LosslessStringConvertible?

I was a bit surprised see that UUID doesn't conform to LosslessStringConvertible, when I discovered that Vapor provides its own conformance:

Any reason for this omission? Should it be filed as private feedback, or are any of these Foundation issues tracked more publicly?

2 Likes

A couple of years ago, I tried this in apple/swift#28706 (tracked as rdar://problem/57847799).

Is it possible to add extension UUID: LosslessStringConvertible with narrower availability than the type — but without breaking source compatibility?

I don't think so. I only brought this up because it'd be a useful conformance for Foundation to ship with, but I guess they're tracking it internally, so hopefully some day?

I've submitted a PR to Vapor removing this conformance since it seems like a problematic thing to include.

1 Like

The blocking issue at the time was that we couldn't add new protocol conformances with availability annotations. That's recently changed, so this looks like something we can now actually do. I'll check on the status of the bug. Thanks for pinging us!

9 Likes