Questions tagged [scala-2.9]

Version 2.9 of the Scala language for the JVM.

Version 2.9 included many changes, notably the introduction of parallel collections.

Scala is a general purpose programming language principally targeting the Java Virtual Machine. Designed to express common programming patterns in a concise, elegant, and type-safe way, it fuses both imperative and functional programming styles. Its key features are: statically typed; advanced type-system with type inference; function types; pattern-matching; implicit parameters and conversions; operator overloading; full interop with Java.

See for more information.

102 questions
4
votes
1 answer

Confusing Scala Dynamic code snippet

I came across the following code snippet on the Scala mailing list: scala> class DynamicImpl(x: AnyRef) extends Dynamic { | def _select_(name: String): DynamicImpl = { | new DynamicImpl(x.getClass.getMethod(name).invoke(x)) | …
missingfaktor
  • 86,952
  • 56
  • 271
  • 360
4
votes
1 answer

Methods in trait become volatile methods when mixed in concrete classes in 2.9.0-1 but not 2.8.1

I noticed this breaking (for me using it with OGNL) change in 2.9.0-1: I find that, in 2.9, methods declared in a trait become volatile when mixed in a class: Example in 2.9.0-1 import java.lang.reflect.Modifier trait SuperTrait { def getKnoll…
andreak
  • 884
  • 7
  • 10
4
votes
1 answer

Unable to override java.lang.String field. What is wrong?

I tried to compile code that contains class FixedIndexedRepository(override val name: java.lang.String, location: URI) extends FixedIndexedRepo Which extends FixedIndexedRepo which extends Java class AbstractIndexedRepo public abstract class…
Ezhik
  • 829
  • 5
  • 23
4
votes
1 answer

Why does 2.10 insist on specifying type parameter bounds (worked fine in 2.9)?

I have the following case class: case class Alert[T <: Transport](destination: Destination[T], message: Message[T]) In Scala 2.9.2, the following method signature has compiled fine: def send(notification: Alert[_]) { notification match { ... …
pr1001
  • 20,621
  • 16
  • 74
  • 123
4
votes
3 answers

Scala 2.10 vs. 2.9 incompatibilities

What are the Scala 2.10 vs. 2.9 incompatibilities and how to deal with them? Especially core libraries, but any issues with popular libraries might be interesting. Links to official documents are appreciated.
Jakozaur
  • 1,917
  • 3
  • 18
  • 19
4
votes
1 answer

How to import class using fully qualified name?

create file test1.scala with following code: package test import java.io.FileInputStream object Foo create another file test2.scala with following code: package test.java object Bar Now compile as scalac test1.scala test2.scala: We get the…
Jus12
  • 17,058
  • 25
  • 90
  • 151
4
votes
1 answer

Sealed Trait / Object Case Class Byte Code Changed from 2.9.1. to 2.9.2?

Same source file in both directories I have the following sealed trait in Errors.scala that I would like to reference in a Java class. In Scala 2.9.1, I was able to reference Errors.TooBig from Java as Errors$TooBig$ That no longer compiles in…
Matt Hughes
  • 1,418
  • 2
  • 14
  • 17
4
votes
1 answer

What is the easiest 2D game library to use with Scala?

I need to integrate a scala library for reinforcement learning that works on scala 2.9.1 with a 2D game library. If it uses SBT that would be awesome. I was looking at scage, however the current master branch is broken, it works on maven, and the…
placeybordeaux
  • 1,928
  • 1
  • 16
  • 35
4
votes
1 answer

counting down in scala for loop

Possible Duplicate: Decreasing for loop in Scala? While working through Scala For The Impatient, I came upon the following exercise: Write a Scala equivalent for the Java loop for (int i = 10; i >= 0; i--) System.out.println(i); It did…
pohl
  • 3,078
  • 1
  • 26
  • 48
3
votes
1 answer

Using Scala's ObservableMap

I'm trying to use scala.collection.mutable.ObservableMap. I grabbed the snippet below from scala-user and copied it to the REPL. The email mentions ticket 2704 which has been marked as fixed but this snippet does not work. So has the syntax changed…
Brian
  • 19,258
  • 6
  • 32
  • 51
3
votes
2 answers

scala actors: drop messages if queue is too long?

I would like to drop messages from an actor's mailbox if it becomes too full. For example, if the queue size reaches 1000 messages, the oldest one should be deleted.
Kim Stebel
  • 40,545
  • 12
  • 119
  • 139
3
votes
2 answers

Installing Scala 2.9 nightly build

How to install Scala 2.9 nightly build on Ubuntu?
Łukasz Lew
  • 43,526
  • 39
  • 134
  • 202
3
votes
1 answer

I can define a bang operator method, but I can't call it in Scala. Why?

First I define ! method: scala> def !() = "hi" $bang: ()java.lang.String Now I can call it like so: scala> $bang() res3: java.lang.String = hi But this doesnt' work: scala> !() :8: error: value unary_! is not a member of Unit …
tuxdna
  • 7,669
  • 3
  • 36
  • 59
3
votes
3 answers

Scala case class generated field value

I have an existing Scala application and it uses case classes which are then persisted in MongoDB. I need to introduce a new field to a case class but the value of it is derived from existing field. For example, there is phone number and I want to…
Petteri H
  • 10,877
  • 11
  • 60
  • 94
3
votes
2 answers

Scala method call with generic arguments appears not polymorphic - what is wrong

Can't figure out why is this wrong or how to resolve it. Here's "distilled" code that reproduces the problem. Please help, but I'd appreciate none of the "why" questions - there are very real and valid answers to that but they are proprietary and…
Learner
  • 1,015
  • 9
  • 23