akkadotnet/akka.net — pull request #152 by HCanber (2014-06-26 09:24:49+00:00)
Title: Change Receive to work like Akka

## TL;DR
Akka and Akka.Net differs when it comes to Receive. This PR changes Akka.Net to be like Akka.
Breaking change for inheritors of `ActorBase`.
No breaking change for inheritors of `UntypedActor`.
Since breaking changes are introduced I choose to be detailed about what I´ve done.

### Akka
Akka uses a [PartialFunction](http://www.scala-lang.org/api/current/index.html#scala.PartialFunction) for its receive function. If the partial function isn't defined for a message, the `unhandled` function is invoked. By default `unhandled` publishes a `UnhandledMessage` on the EventStream. If the user don't like the default behavior, `unhandled` can be overriden.

Akka´s `Receive` type is declared as:
```scala
type Receive = PartialFunction[Any, Unit]
```
with the functions:
```
apply(Any message) : Unit
isDefinedAt(Any message) : Boolean
```

Pseudo code for handling a message is:
```c#
if(receive.isDefinedAt(message))
receive.apply(message)
else
unhandled(message)
```

### Akka.Net
In the current implementation of Akka.Net `OnReceive` has the signature `void OnReceive(object message)` and if the message is unhandled the user must manually call `Unhandled(message)` (which publishes to the EventStream) to signal that the message was unhandled. The user cannot override `Unhandled`.

Instead of having our own way of doing this, I would like Akka.Net to be like Akka and in order to do that we need to mimic the [PartialFunction](http://www.scala-lang.org/api/current/index.html#scala.PartialFunction) used in Akka.

In Akka.Net the Receive is basically an `Action