From c6ce203b92ccbeebdc8af5016e544768cb059937 Mon Sep 17 00:00:00 2001 From: paltherr Date: Tue, 18 Mar 2003 12:36:03 +0000 Subject: - Fixed some minor errors --- sources/examples/ComputeServer.scala | 6 +++--- sources/examples/auction.scala | 2 +- sources/examples/boundedbuffer.scala | 4 ++-- sources/examples/maps.scala | 8 ++++---- sources/examples/parsers.scala | 2 +- sources/examples/typeinf.scala | 4 ++-- sources/scala/Ord.scala | 2 +- sources/scala/concurrent/MailBox.scala | 2 +- sources/scala/concurrent/ops.scala | 2 +- 9 files changed, 16 insertions(+), 16 deletions(-) diff --git a/sources/examples/ComputeServer.scala b/sources/examples/ComputeServer.scala index e322860b78..c3ea4907ad 100644 --- a/sources/examples/ComputeServer.scala +++ b/sources/examples/ComputeServer.scala @@ -11,16 +11,16 @@ class ComputeServer(n: Int) { private val openJobs = new Channel[Job](); - private def processor(i: Int): Unit { + private def processor(i: Int): Unit = { while (True) { val job = openJobs.read; job.return(job.task) } } - def future[a](def p: a): () => a { + def future[a](def p: a): () => a = { val reply = new SyncVar[a](); openJobs.write{ - new Job with { + new Job { type t = a; def task = p; def return(x: a) = reply.set(x); diff --git a/sources/examples/auction.scala b/sources/examples/auction.scala index 2d00fca880..e553752342 100644 --- a/sources/examples/auction.scala +++ b/sources/examples/auction.scala @@ -22,7 +22,7 @@ class Auction(seller: Actor, minBid: Int, closing: Date) extends Actor() { val timeToShutdown = 36000000; // msec val bidIncrement = 10; override def run() = execute; - def execute { + def execute = { var maxBid = minBid - bidIncrement; var maxBidder: Actor = _; var running = true; diff --git a/sources/examples/boundedbuffer.scala b/sources/examples/boundedbuffer.scala index f308d0d472..6f71f72cf5 100644 --- a/sources/examples/boundedbuffer.scala +++ b/sources/examples/boundedbuffer.scala @@ -2,7 +2,7 @@ package examples; import concurrent.ops._; -class BoundedBuffer[a](N: Int) extends Monitor() with { +class BoundedBuffer[a](N: Int) extends Monitor() { var in = 0, out = 0, n = 0; val elems = new Array[a](N); @@ -27,4 +27,4 @@ module test { def consumeString(ss: String) = System.out.println(ss); spawn { while (True) { val ssss = produceString ; buf.put(ssss) } } spawn { while (True) { val s = buf.get ; consumeString(s) } } -} \ No newline at end of file +} diff --git a/sources/examples/maps.scala b/sources/examples/maps.scala index bcd73e0066..2f9471d2dd 100644 --- a/sources/examples/maps.scala +++ b/sources/examples/maps.scala @@ -1,7 +1,7 @@ module maps { trait MapStruct[kt, vt] { - trait Map extends Function1[kt, vt] with { + trait Map with Function1[kt, vt] { def extend(key: kt, value: vt): Map; def remove(key: kt): Map; def domain: Stream[kt]; @@ -65,7 +65,7 @@ module maps { class OOBinTree[kt <: Ord[kt], vt <: AnyRef]() extends MapStruct[kt, vt] { type map = OOMap; - trait OOMap extends Map with { + trait OOMap extends Map { def apply(key: kt): vt; def extend(key: kt, value: vt): map; def remove(key: kt): map; @@ -79,7 +79,7 @@ module maps { def domain: Stream[kt] = Stream.empty; def range: Stream[vt] = Stream.empty; } - private class Node(k: kt, v: vt, l: map, r: map) extends OOMap with { + private class Node(k: kt, v: vt, l: map, r: map) extends OOMap { def apply(key: kt): vt = if (key < k) l.apply(key) else if (key > k) r.apply(key) @@ -104,7 +104,7 @@ module maps { class MutBinTree[kt <: Ord[kt], vt <: AnyRef]() extends MapStruct[kt, vt] { type map = MutMap; - class MutMap(key: kt, value: vt) extends Map with { + class MutMap(key: kt, value: vt) extends Map { val k = key; var v = value; var l = empty, r = empty; diff --git a/sources/examples/parsers.scala b/sources/examples/parsers.scala index 43a386e8db..efe90fc306 100644 --- a/sources/examples/parsers.scala +++ b/sources/examples/parsers.scala @@ -4,7 +4,7 @@ module Parse { type Result = Option[List[Char]]; - trait Parser extends Function1[List[Char],Result] with { + trait Parser with Function1[List[Char],Result] { def &&& (def p: Parser) = new Parser { def apply(in: List[Char]) = Parser.this.apply(in) match { case Some(in1) => p(in1) diff --git a/sources/examples/typeinf.scala b/sources/examples/typeinf.scala index 5ff6f03f50..af94f9d3c4 100644 --- a/sources/examples/typeinf.scala +++ b/sources/examples/typeinf.scala @@ -40,7 +40,7 @@ case class ListSet[a](elems: List[a]) { module typeInfer { - trait Subst extends Function1[Type,Type] { + trait Subst with Function1[Type,Type] { def lookup(x: Tyvar): Type; def apply(t: Type): Type = t match { case Tyvar(a) => val u = lookup(Tyvar(a)); if (t == u) t else apply(u); @@ -159,4 +159,4 @@ module test { showType(Lam("x", App(App(Var("cons"), Var("x")), Var("nil")))); -} \ No newline at end of file +} diff --git a/sources/scala/Ord.scala b/sources/scala/Ord.scala index 5cf7b6cd91..bfe845c615 100644 --- a/sources/scala/Ord.scala +++ b/sources/scala/Ord.scala @@ -5,4 +5,4 @@ trait Ord[t <: Ord[t]]: t { def <=(that: t): Boolean = this < that || this == that; def > (that: t): Boolean = that < this; def >=(that: t): Boolean = that <= this; -} \ No newline at end of file +} diff --git a/sources/scala/concurrent/MailBox.scala b/sources/scala/concurrent/MailBox.scala index 2e74d8e1fa..62a102781e 100644 --- a/sources/scala/concurrent/MailBox.scala +++ b/sources/scala/concurrent/MailBox.scala @@ -35,7 +35,7 @@ class MailBox() extends Monitor() { } } - def scanSentMsgs[a](r: Receiver with { type t = a }): Unit = synchronized { + def scanSentMsgs[a](r: Receiver { type t = a }): Unit = synchronized { var ss = sent, ss1 = ss.next; while (ss1 != null && !r.receiver.isDefinedAt(ss1.elem)) { ss = ss1; ss1 = ss1.next diff --git a/sources/scala/concurrent/ops.scala b/sources/scala/concurrent/ops.scala index 438a7d58e2..8b52975ef1 100644 --- a/sources/scala/concurrent/ops.scala +++ b/sources/scala/concurrent/ops.scala @@ -30,7 +30,7 @@ module ops { } } - def parMap[a,b](f: a => b, xs: Array[a]): Array[b] { + def parMap[a,b](f: a => b, xs: Array[a]): Array[b] = { val results = new Array[b](xs.length); replicate(0, xs.length) { i => results(i) = f(xs(i)) } results -- cgit v1.2.3