为什么我不能在 akka 集群分发数据示例中使用大写字母作为 var 的第一个字符

why I can't use capital as the first character of the var in akka cluster distribute data example

我正在尝试 https://doc.akka.io/docs/akka/current/distributed-data.html#using-the-replicator 上的官方示例 (本页第一个 Scala 示例)
但是当我稍微更改我的代码时,它看起来很奇怪。

我录制了我在代码中更改的视频。我所做的唯一更改是 16.From 行上的变量名称 DataKey 到 dataKey。我刚刚改名了。 https://photos.app.goo.gl/CZrnNZlW85e9MaF73

现在的问题是为什么会这样。
在此示例中,我不能使用大写字母作为 var 的第一个字符 ???
请帮我算一下 out.Thanks 非常。

阿卡 Version:2.5.9
Scala Version:2.11.12
IDE:IntelliJ IDEA 2017.3.3 社区版

关于与@的模式匹配,@允许您在匹配后处理对象本身。在您的示例中,您检查变量 c,如果该变量是对象 Changed(DataKey),则您通过对象本身 [=17] 上的方法 get 检索 DataKey =]

 case c @ Changed(DataKey) ⇒
      val data = c.get(DataKey)

我终于找到问题的答案了! 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.