score:6
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.
Source: stackoverflow.com
Related Query
- Scala case class is not matched in receive method (in akka actors)
- Alternate constructor on Scala case class not defined: not enough arguments for method
- unapply method of a case class is not used by the Scala compiler to do pattern matching, why is that?
- Scala - not a case class nor does it have method .unapply
- Scala case class private constructor but public apply method
- Composing trait behavior in Scala in an Akka receive method
- Why not make every Scala class a case class?
- scala case class equals (==) not working as expected
- Scala IDE Error: Main method not found in class 'hello'
- java.lang.NoSuchMethodException for init method in Scala case class
- scala case class copy method is unseen from java code
- toString method for inherited case class in Scala
- Scala Implicit Method Compilation when Method Tries to Access Non-Existing Case Class Members
- Declaring a method to accept an unknown case class as argument to use it in pattern matching in Scala
- Scala type inference not working with generic case class and lambda
- Scala compiler says my method is recursive in case when implicits and anonymous class is used
- scala - how to access a case class method from another class?
- Write an Arbitrary Value Not Found in a Case Class Using Play's (2.2) Scala JSON Combinators
- Scala method clone in class Object cannot be accessed in T Access to protected method clone not permitted because
- Playframework, scala case class and property not found
- Transfer Scala case class to JsValue in rdd.map func but Task not serializable
- Equality of Scala case class does not work in junit assertEquals when it contains an inner Array
- Scala 2.9.2 can not handle the overloaded format method of the String class - why?
- Scala case class copy method with Map parameter
- Scala match on Option[Object] not exhaustive with Some(o) and None in Akka receive function
- Not able to use JSON Macro Inception to convert nested JSON structure to Scala case class object
- Scala ambiguous case class generated and companion apply method
- Spark dataframe ".as" function does not drop columns not present in matched case class
- Parse json array to a case class in scala using playframework with the fields in json not matching the fields in case class
- Which is faster for comparing case class object in scala : a) equals(==) method or b) equating hash values
More Query from same tag
- Spark SQL sum rows with the same key and appending the sum value
- Spark: Get elements of an RDD based on the elements of an array in another RDD
- AOP around overridden methods of external library?
- akka-http-testkit with akka-actor-testkit-typed
- Scala - Processing XML to JSON Objects in Functional Style
- Spark Scala Register UDF - Why I need to pass underscore (_) at the end of function
- Using Scala to implement a domain layer spanning a range of java based services
- Scala Tree/Graph Implementation
- Scala: How to modify some variable in class by method?
- Spark as execution engine with Hive
- passing non tuple to (Int,Int)=>() compiles, why?
- How to tune Play Framework application with proper threadpools?
- How to apply regex pattern on a dataframe in scala?
- How do you gracefully end a Spark application prematurely?
- Scala error: type mismatch
- slick3: select random row
- Apache Spark - Is it possible to use a Dependency Injection Mechanism
- Why did the scala compiler not flag what appears to not be a tail-recursive function?
- Apache-spark: How to pass Iterable[String] as parameter in a function
- What design decisions would favour Scala's Actors instead of JMS?
- Spark DataFrame with current date + 10
- What does the syntax ::[T] =_ means in Scala?
- Scala: Detect and extract something more specific from a collection of `Any` values
- compare filenames to get the latest file using ID and timestemp information and merge into one file afterwards in spark scala
- How to combine four lists into a list of lists in Scala
- scalatest intercept vs a[Exception] should be thrownBy
- Why does scala complain when given this pattern match on an integral value?
- Play framework 2.1 transform giant json structure
- scala manipulating Model object values
- Is there any Scala DSL for GUI?