It would be useful to define "thespian-aware" traits that actors can implement and be used to abstract over the concrete actor being communicated with. For example, we may want to create a mock actor implementation for use in testing, in which case we need a way to swap between the "real" actor instance and the mock.
This can be accomplished by generating concrete message types for the functions a trait, and then reusing those existing messages when implementing the trait for the actor rather than generating different message types for each actor implementing the trait. For example:
We would also need a way to convert a proxy for an actor that implements an actor trait into the trait's proxy type. This will likely also require implementing a more flexible ProxyFor equivalent, since the current ProxyFor is generic over a concrete actor type and we instead need to be "generic over a trait" (which isn't actually possible with Rust's current type system). This will likely require a heavy dose of type erasure, and we may need to lean on code generation to produce some extra dummy types to make this work. Explorations into the design space here are welcome!
It would be useful to define "thespian-aware" traits that actors can implement and be used to abstract over the concrete actor being communicated with. For example, we may want to create a mock actor implementation for use in testing, in which case we need a way to swap between the "real" actor instance and the mock.
This can be accomplished by generating concrete message types for the functions a trait, and then reusing those existing messages when implementing the trait for the actor rather than generating different message types for each actor implementing the trait. For example:
Would generate the following helper types:
We would also need a way to convert a proxy for an actor that implements an actor trait into the trait's proxy type. This will likely also require implementing a more flexible
ProxyFor
equivalent, since the currentProxyFor
is generic over a concrete actor type and we instead need to be "generic over a trait" (which isn't actually possible with Rust's current type system). This will likely require a heavy dose of type erasure, and we may need to lean on code generation to produce some extra dummy types to make this work. Explorations into the design space here are welcome!