Reputation: 413
When I override the bang (!) operator in Scala, it's invoked on the actor which is the recipient of the message. Is there a way I can find out who sent this msg to this actor inside the overridden bang operator?
Thanks,
Upvotes: 0
Views: 226
Reputation: 10411
Please see here how to override the behavior of the bang operator. In your particular case you can override it by wrapping the original message in an envelop containing the sender.
How to override bang operator(!) for different type of inputs in scala
Also, please note that the Scala 2.9's actors API will become deprecated. Consider using Akka instead which does provide the functionality you are looking for.
Upvotes: 4