I have been exercising a library that supports the creation of (speaking loosely) processes. When a process is launched from outside of any process of the scheme, the new process is told a procedure to execute. A process may `fork`, which creates and launches another process having some of the same attributes as the calling process (in particular, the same scheduler). Processes can terminate with success or failure. An operation `alts` is available that is handed a series of procedures to try until one of them succeeds.
For implementing `fork`, `alts`, and similar operations, it seemed natural to want to clone the process. To support these uses, I packaged a scheme that allows to specify how cloning is to work for a clone family. The specification is handed to a library function and it returns the first prototype of the family. Client code will ask this prototype to clone itself to get objects to use (and mutate).
The specification for a clone family can include:
- methodsToBind: every clone will bear these as partially evaluated with itself as the receiver. The bound procedures are convenient to pass as callback functions, e. g. through the scheduler.
- heritableProperties: these form the traits object to which all the clones delegate.
- noCopyKeys: slots having these keys are not copied.