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
7
votes
1 answer

Why doesn't scala's parallel sequences have a contains method?

Why does List.range(0,100).contains(2) Work, while List.range(0,100).par.contains(2) Does not? This is planned for the future?
placeybordeaux
  • 2,138
  • 1
  • 20
  • 42
6
votes
2 answers

Scala List Comprehensions

I'm trying to generate a list in scala according to the formula: for n > 1 f(n) = 4*n^2 - 6*n + 6 and for n == 1 f(n) = 1 currently I have: def lGen(end: Int): List[Int] = { for { n <- List.range(3 , end + 1 , 2) } yields { 4*n*n - 6*n - 6…
LeeG
  • 265
  • 1
  • 4
  • 11
6
votes
1 answer

Array[Nothing with java.lang.Object] required in Scala 2.9.1

I have a weird compilation error. The offending lines are: val comboBoxLanguage = new javax.swing.JComboBox //... comboBoxLanguage.setModel(new javax.swing.DefaultComboBoxModel( Array[Object]("Scala", "Java"))) and the error: error: type…
Luigi Plinge
  • 50,650
  • 20
  • 113
  • 180
6
votes
1 answer

Scala 2.9 Bridge-Method

I'm using Scala 2.9.1 I've defined a Logging trait as such: trait Logging { def debug(msg: String, throwables: Throwable*) = .... .... } And I have a JMSPublisher class which mixes-in the Logging trait: class JMSPublisher extends…
shj
  • 1,558
  • 17
  • 23
6
votes
1 answer

Is this a bug in scala 2.9.0.1 actor library

The following code works fine in Scala 2.8 but not in 2.9.0.1 (copy and paste in REPL). This will throw an exception in 2.9.0.1. import scala.actors.Actor import scala.actors.TIMEOUT object A2 extends Actor { def act = { loop { react { …
Jus12
  • 17,824
  • 28
  • 99
  • 157
6
votes
3 answers

Dynamic Proxy using Scalas new Dynamic Type

Is it possible to create an AOP like interceptor using Scalas new Dynamic Type feature? For example: Would it be possible to create a generic stopwatch interceptor that could be mixed in with arbitrary types to profile my code? Or would I still…
gruenewa
  • 1,666
  • 11
  • 16
6
votes
3 answers

Using ListView from Scala 2.9.2 with Java 7 gives compile error

I'm working on a project that use scala 2.9.2 and java 7. What I'm trying to do is create a GUI using the scala ListView. Here's a small code snippet: private val listView = new ListView[Document](someList) . . . for (selectedDocument <-…
ulejon
  • 631
  • 5
  • 22
6
votes
2 answers

Step by step guide to get Scala to run on .net?

I have never used .Net framework and need to demonstrate to someone that Scala indeed works on .Net. I need to get a "quick and dirty" .Net setup with Scala working on some existing JVM Scala code. I could not find a step-by-step guide for this. I…
Jus12
  • 17,824
  • 28
  • 99
  • 157
6
votes
3 answers

Generic collect by type in scala

In Scala 2.9.1 With def collectFirstOfT[T](la: List[_])(implicit m:Manifest[T]) : Option[T] = { la.collect{case x if m.erasure.isAssignableFrom(x.getClass) => x}. headOption.asInstanceOf[Option[T]]} class A class B why this expression : val…
jwinandy
  • 1,739
  • 12
  • 22
5
votes
0 answers

What IDEs support SBT and Scala version 2.9.0

Possible Duplicate: Which IDE for Scala 2.8? I would like to know which IDEs specifically support Scala 2.9 and the sbt project ?
ouertani
  • 347
  • 3
  • 8
5
votes
1 answer

How do I use nightly builds of Scala 2.9 with maven?

Recently I wanted to try some of the new features in Scala 2.9 in a small project. I would like to use maven for building it. How can I tell Maven to use the latest nightly build of Scala 2.9? If someone knows how to do this with sbt instead of…
Kim Stebel
  • 41,826
  • 12
  • 125
  • 142
5
votes
1 answer

How can I override a method with a dependent return type?

I'm having trouble in Scala 2.9.2 implementing a method which declares a dependent return type. The following code object DependentTypesQuestion { def ??? = throw new UnsupportedOperationException trait X { trait Y } trait Z { def…
Scott Morrison
  • 3,100
  • 24
  • 39
5
votes
1 answer

Why does Scala define a "+=" operator for Short and Byte types?

Given the following scala code: var short: Short = 0 short += 1 // error: type mismatch short += short // error: type mismatch short += 1.toByte // error: type mismatch I don't questioning the underlying typing - it's clear that "Short +…
Richard Sitze
  • 8,262
  • 3
  • 36
  • 48
5
votes
3 answers

How can I use Scala's MurmurHash implementation: scala.util.MurmurHash3?

I'm writing a BloomFilter and wanted to use Scala's default MurmurHash3 implementation: scala.util.MurmurHash3. My compile is failing however with the following compile error: [error]…
dr.
  • 247
  • 1
  • 5
  • 13
4
votes
3 answers

Scala: Generic class with multiple constructors

I'm trying to create a generic class like this: class A[T](v: Option[T]) { def this(v: T) = this(Some(v)) def this() = this(None) def getV = v } Then I do some testing: scala> new A getV res21: Option[Nothing] = None scala> new A(8)…
Vilius Normantas
  • 3,708
  • 6
  • 25
  • 38