When I call:
actor_ ! Exit
How is this being converted into a construction of:
case class Exit(from: AbstractActor, reason: AnyRef)
In particular, how is it that when I call this from a remote (client) actor which has been link
ed to a remote (server) actor, that the server receives an instance of Exit
where the from
property is an actor:
'remotesender0@Node(10.10.7.90,8366)
Basically I'd like to figure out how I can get a handle on this remote-client-actor object!
_1 is a method name. Specifically tuples have a method named _1 , which returns the first element of the tuple.
A Scala Case Class is like a regular class, except it is good for modeling immutable data. It also serves useful in pattern matching, such a class has a default apply() method which handles object construction. A scala case class also has all vals, which means they are immutable.
A class can extend another class, whereas a case class can not extend another case class (because it would not be possible to correctly implement their equality).
Case Classes You can construct them without using new. case classes automatically have equality and nice toString methods based on the constructor arguments. case classes can have methods just like normal classes.
What you are sending is the singleton object Exit
. In the Scala API, just scroll down past the classes, and look up the objects.
object Exit
extends (AbstractActor, AnyRef) => Exit
Now, I haven't seen your code, so I don't know how you are using it. Notice, though, that this object Exit is (actually, extends) a function, which takes two parameters and returns an Exit case class formed by them. It will also have some stuff put in it by the case class statement.
Or, in other words, Exit.apply(x,y) (the function Exit being applied) has the same result as Exit(x,y) (the constructor for class Exit). But while you can't pass a class, you can pass an object.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With