score:6

Accepted answer

after searching more, i found an answer on scala-lang.org:

i think the underlying misconception is about the identity of nested class types.

in

class a { class b }

each new instance of class a x creates a new type x.b. and if you do the plain pattern match inside of a you are referring to the specific instance of the type b this.b.

score:2

a way to pattern-match on probe without moving it outside the class is

case probe: probeactor#probe => println("good probe: "+probe.messagekey)

of course, moving it outside (e.g. to the companion object) is the better solution; particularly in akka, as archeg mentions, to avoid the direct reference to the actor.


Related Query

More Query from same tag