diff options
author | Martin Odersky <odersky@gmail.com> | 2004-01-12 10:56:44 +0000 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2004-01-12 10:56:44 +0000 |
commit | 5665f6b29c900fbfeee2f8f45752bc74947093d7 (patch) | |
tree | 16754135e12c6d8ac32d941dfb45cc80cf4c40e0 /doc/reference | |
parent | 8698d99b934a7982353db3632abfc54d0acb80f3 (diff) | |
download | scala-5665f6b29c900fbfeee2f8f45752bc74947093d7.tar.gz scala-5665f6b29c900fbfeee2f8f45752bc74947093d7.tar.bz2 scala-5665f6b29c900fbfeee2f8f45752bc74947093d7.zip |
*** empty log message ***
Diffstat (limited to 'doc/reference')
-rw-r--r-- | doc/reference/ScalaByExample.tex | 20 |
1 files changed, 3 insertions, 17 deletions
diff --git a/doc/reference/ScalaByExample.tex b/doc/reference/ScalaByExample.tex index 786d83611d..baf099238d 100644 --- a/doc/reference/ScalaByExample.tex +++ b/doc/reference/ScalaByExample.tex @@ -6714,24 +6714,10 @@ implementation of an electronic auction service. This service was based on high-level actor processes, that work by inspecting messages in their mailbox using pattern matching. An actor is simply a thread whose communication primitives are those of a mailbox. Actors are -defined as an extension of Java's standard \code{Thread} class which -forwards all communication calls to an internal mailbox. +hence defined as a mixin composition extension of Java's standard +\code{Thread} class with the \code{MailBox} class. \begin{lstlisting} -abstract class Actor extends Thread { - - type Message = AnyRef; - - private val mb = new MailBox; - - def send(msg: Message): unit = - mb.send(msg); - - def receive[a](f: PartialFunction[Message, a]): a = - mb.receive(f); - - def receiveWithin[a](msec: long)(f: PartialFunction[Message, a]): a = - mb.receiveWithin(msec)(f); -} +abstract class Actor extends Thread with MailBox; \end{lstlisting} \comment{ |