eengbrec / Scala Enhancements

In-progress enhancements to the Scala standard library, mostly centered around actors.

commit 82: 14e33a6ea1f8
parent 70: 2af7041fc9f9
branch: message_queue_patch
message queue patch
eengbrec
9 months ago
r82:14e33a6ea1f8 25 loc 936 bytes embed / history / annotate / raw /
/*                     __                                               *\
**     ________ ___   / /  ___     Scala API                            **
**    / __/ __// _ | / /  / _ |    (c) 2005-2009, LAMP/EPFL             **
**  __\ \/ /__/ __ |/ /__/ __ |    http://scala-lang.org/               **
** /____/\___/_/ |_/____/_/ | |                                         **
**                          |/                                          **
\*                                                                      */

package scala.actors

import scala.reflect.Manifest

object Message {
  def apply[T](content: T, sender: OutputChannel[Any]): Message[T] = BasicMessage(content, sender)
  def unapply[T](msg: Message[T]) = Some((msg.content, msg.sender))
}


trait Message[+T] {
  val content: T
  val sender: OutputChannel[Any]
}


case class BasicMessage[+T](val content: T, val sender: OutputChannel[Any]) extends Message[T]