I am trying the official example on https://doc.akka.io/docs/akka/current/distributed-data.html#using-the-replicator
(The first scala example on this page)
But it seems strange when I change my code a little bit.
I record a video what I change in the code .The only change I made is the name of the variable on line 16.From DataKey to dataKey. I just renamed it. https://photos.app.goo.gl/CZrnNZlW85e9MaF73
Now the question is why it happened.
I can't use capital as the first character of the var in this example ???
Please help me to figure that out.Thanks very much.
Akka Version:2.5.9
Scala Version:2.11.12
IDE:IntelliJ IDEA 2017.3.3 Community Edition
I finally find the answer to the question! https://www.safaribooksonline.com/library/view/programming-scala-2nd/9781491950135/ch04.html
There are a few rules and gotchas to keep in mind when writing case clauses. The compiler assumes that a term that starts with a capital letter is a type name, while a term that begins with a lowercase letter is assumed to be the name of a variable that will hold an extracted or matched value.
In case clauses, a term that begins with a lowercase letter is assumed to be the name of a new variable that will hold an extracted value. To refer to a previously defined variable, enclose it in back ticks. Conversely, a term that begins with an uppercase letter is assumed to be a type name.