These are chat archives for petabridge/akka-bootcamp

3rd
Mar 2015
Ashutosh Raina
@ashutoshraina
Mar 03 2015 05:21
Quick question if anyone will answer …is there a way at compile time to esnure that my Receive semantics are exhaustive within the Actor….this is related to C#…I assume this will be ppossible in F#
Bartosz Sypytkowski
@Horusiath
Mar 03 2015 06:26
@ashutoshraina it's rather hard in C#, because it doesn't have such definition as exhausive conditions right now. When in runtime, you may use Match() extension method shipped with Akka, which works similar to pattern matching in functional languages, but again this is runtime feature. Eg:
var wasHandled = message.Match()
    .With<Class1>(x => {})
    .With<Class2>(x => {})
    .WasHandled;
Ashutosh Raina
@ashutoshraina
Mar 03 2015 08:06
@Horusiath thanks .. I was thinking along the same lines ...
Håkan Canberger
@HCanber
Mar 03 2015 08:13
@ashutoshraina Since we match against objects, it's impossible to do exhaustive matching. You need something that contains a finite number of values (like in enum) or types (like F# have) that is known at compile time. We'll have to wait for C# records do to proper pattern matching.