URLs as Swift Package Identifiers

I do use the SPM quite a bit, but have not been following this proposal, so take what I say with some salt.

My observation is more general. My background is decentralised systems (eg https://ensembles.io, GitHub - mentalfaculty/LLVS: Low-Level Versioned Store). Every decentralized system I have been involved with has included some form of global identification. Not including any form of global identification introduces great challenges.

I have seen these problems often in practice. To give an example most will have some familiarity with, Apple's Core Data sync went with a system with no global identification of objects. This means every app adopting it has to introduce complex de-duplication logic of its own.

What does this have to do with SPIs? The danger here is that the proposal will go down the same path. Yes, it may at first seem easier to just treat every repo as independent, with every package unrelated and thus identified by a different URL. This is effectively the choice that Apple made in their sync architecture.

The cost comes when you try to relate one package with another in some way. Is it the same package? Can one package be substituted for another? I don't know how the repo manager works internally, but I assume these are the types of questions it has to know the answer to. I fear that by ignoring the existence of forks etc, which are extremely prevalent in our world, we are severely limiting the potential solution.

Adopting a reverse-DNS style identifier such as the one suggested here would fundamentally change the package ecosystem from a federated, decentralized model into one with a central naming authority and governing body.

I actually think the opposite is true here. The point of using reverse DNS, rather than just an arbitrary name (eg LinkedList), is exactly to have a system of generating unique identifiers in a decentralised manner which are extremely unlikely to clash. We want to avoid having a centralised authority. This approach has been used with success in many cases, including UUIDs in decentralised storage (eg Git), and the registration of reverse DNS names for apps.

3 Likes