At this point, ChatRoom is ready to process subscription messages, so let's send some messages to it. Scala's actors library supports both asynchronous and synchronous message sending.
You send a message asynchronously to an actor with the bang (!) symbol. In using ! to denote message sending, Scala follows the tradition of Erlang:
val chatRoom = new ChatRoom chatRoom ! Subscribe(User("Bob"))
The ! method sends a message to chatRoom and returns immediately; it doesn't wait for any confirmation or reply from the target actor. In addition to the message, ! also sends an implicit reference to the sender to the target actor. That reference is always available inside the target actor via the ...