SarfarazSoomro
SarfarazSoomro

Reputation: 413

overriden bang (!) operator. Find sender

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

Answers (1)

Marius Danila
Marius Danila

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

How to overload bang(!) operator in Scala Actor model?

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

Related Questions