在Scala中,单撇号是什么意思? [英] What does a single apostrophe mean in Scala?
本文介绍了在Scala中,单撇号是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在此幻灯片中, ScalaActors.pdf 上的单引号是什么指示何时将消息发送给乒乓球演员?
In this slide show on ScalaActors.pdf what does the single quote indicate when the message is sent to the pong actor?
class Ping(count: int, pong: Pong) extends Actor {
def act() {
pong ! 'Ping // what does the single quote indicate???
receive {
case 'Pong =>
}
}
}
推荐答案
它表示一个符号。例如。 cfr http://www.scala-lang.org/docu/ files / api / scala / Symbol.html :
It indicates a Symbol. Eg. cfr http://www.scala-lang.org/docu/files/api/scala/Symbol.html :
Scala术语 mysym将在以下位置调用Symbol类的构造函数通过以下方式:Symbol( mysym)。
the Scala term 'mysym will invoke the constructor of the Symbol class in the following way: Symbol("mysym").
这篇关于在Scala中,单撇号是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文