Lightweight way to call a swift function as a child process?

What you're describing sounds very similar to a distributed actor system that is being discussed here -- Runtime extensibility via distributed actors - #2 by ktoso

We'd have a binary that we launch and enter the "child process mode" and communicate with it. You could have a distributed actor encapsulate your (distributed) function and this way invoke it in the child process. It doesn't have to be the same binary, but we could think of such way -- I had old old old prototypes with just that in the distributed actors library from way before we even had actors in the language, for inspiration. We could do this much nicer today with (distributed) actors being part of the language though :slight_smile:

I invite you to join the discussion in the Runtime extensibility via distributed actors thread!