Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does a single apostrophe mean in Scala? [duplicate]

Tags:

scala

actor

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 =>
      }
   }
}
like image 763
JeffV Avatar asked May 28 '09 00:05

JeffV


1 Answers

It indicates a Symbol. Eg. cfr http://www.scala-lang.org/docu/files/api/scala/Symbol.html :

the Scala term 'mysym will invoke the constructor of the Symbol class in the following way: Symbol("mysym").

like image 71
Alex Martelli Avatar answered Sep 28 '22 11:09

Alex Martelli