akkadotnet/akka.net — pull request #526 by Horusiath (2014-11-30 22:18:44+00:00)
Title: F# API changes

### New features

1. Included comments for all public functions.
2. All functions now have explicit signatures - this way we won't allow for accidental API breaking changes.
3. Created logging functions:
- `log (level : LogLevel) (mailbox : Actor<'a>) (msg: string) : unit`
- `logDebug (mailbox : Actor<'a>) (msg: string) : unit`
- `logInfo (mailbox : Actor<'a>) (msg: string) : unit`
- `logWarning (mailbox : Actor<'a>) (msg: string) : unit`
- `logError (mailbox : Actor<'a>) (msg: string) : unit`
- `logException (mailbox : Actor<'a>) (msg: string) : unit`
4. Created equivalent of C# PipeTo method working on F# Async<'a> computations - I'm not 100% sure if this will work correctly:
- `pipeTo (computation : Async<'t>) (recipient : ICanTell) (sender : ActorRef) : unit`
- `(|!>) (computation : Async<'t>) (recipient : ICanTell)` - pipe to equivalent used for forward async computation result to right-side recipient with NoSender
- `()` - pipe to equivalent used for forward async computation result to left-side recipient with NoSender
5. Inbox functional API:
- `inbox (system : ActorSystem) : Inbox` - equivalent of `Inboc.Create`
- `receive (timeout : TimeSpan) (i : Inbox) : 'm option` - equivalent of `Inbox.Receive` but statically typed. Returns option with `None` result on timeout exceeded or result of incompatible type returned.
- `filterReceive (timeout : TimeSpan) (predicate : 'm -> bool) (i : Inbox) : 'm option` - equivalent of `Inbox.ReceiveWhere`, again statically typed. Returns option with `None` result on timeout exceeded or result of incompatible type returned.
- `asyncReceive (i : Inbox) : Async<'m option>` - equivalent of `Inbox.ReceiveAsync`. Async computation should return `None` result on result of incompatible type returned. **This may not be a correct implementation and return type may change**

### Breaking changes

1. There is no separate spawning method for actors now. Actor system and actor implementations may both use the same spawning functions now.
2. Removed `spawns` function. Instead `spawnp` function was created `spawnp (system : ActorRefFactory) (name : string) (mapParams : PropsParams -> PropsParams) (f : Actor<'m> -> Cont<'m, 'v>) : ActorRef`. Map params is a mapping function used for specifying all additional parameters to be applied onto inner `Props` object used for actor creation. This is more comprehensive implementation than `spawns`, which could be used only for defining a SupervisorStrategy.
3. `spawne` also takes additional `(mapParams : PropsParams -> PropsParams)` parameter.

### Examples updated + one new example

All of the changes above have been applied to F# API examples. Additionally there is a new sample showing use of F# spawning function for Remote Deployment feature - unlike the C# one, this is *share nothing* example, which means that there are no libraries with shared code. Actor logic is serialized as F# expression, send over the wire and then compiled and executed onto remote actor system!