Right, what you're asking about is effectively "where is service actor discovery implemented?"
Indeed it is not the Swift runtime's job to implement any of that. Though maybe some day as we gain enough confidence we could solidify the Receptionist "pattern" into a specific protocol that actor systems are asked to implement... but realistically: all actor systems implement these very differently.
You'll likely enjoy this talk I did recently: [Video] Distributed Actors announced at Scale by the Bay where we announced our distributed actor cluster implementation. In there I mention a little bit about how the receptionist is implemented. If you're really adventurous, you could even read the implementation, over here: https://github.com/apple/swift-distributed-actors/blob/main/Sources/DistributedActors/Cluster/Reception/OperationLogDistributedReceptionist.swift#L18-L149
Yeah, the mechanism to "register functions and look them up" is general and not tied to distributed actors per se. We currently only surface this feature for distributed funcs but the implementation is not tied to actors specifically. It is not a goal of this proposal to make this into a general mechanism, but we're doing out best to not hardcode it to anything actor specific.
Oh, summon can take many forms which is why I skipped over it.
The simplest thing could really be:
func summonType(id: Int) -> Any.Type {
[1: Int.self, 2.String.self][id]
}
Which may seem silly but is actually very powerful! Thanks to known type registries like that a system is able to survive type renames as well as avoid sending serialized mangled names over the wire for "well known types". This is extensible to user types, so not only Swift types can be send around as IDs. This style does require registering all types you intend to trust in messages though. Which honestly sometimes is a good thing, even if annoying ![]()
The other approach, is what we'll be doing for now in our impls at least... is sending around mangled names, and yes, there is a function though it is not supported to get a type from a mangled name. So you can _typeByName a mangled name and get an Any.Type back... To actually make use of it statically there are a bunch of other trickery one can do, none are really supported -- which is another reason I did not want to explain them in the proposal.
So this is the two techniques: mangled names (very convenient, not super great for security), or type registration (great for security, performance).
--
Thanks for reading the early proposal and the comments already, cheers!