scala-2.9

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

守給你的承諾、 提交于 2019-12-21 05:04:35
问题 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 would appreciate some resources on this: How to install minimal .Net and which version to get Scala to work. How to install the .Net variant of Scala and which version to use (preferred 2.9). How to get hello world to run. Thanks in advance.

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

空扰寡人 提交于 2019-12-21 05:04:01
问题 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 would appreciate some resources on this: How to install minimal .Net and which version to get Scala to work. How to install the .Net variant of Scala and which version to use (preferred 2.9). How to get hello world to run. Thanks in advance.

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

孤街醉人 提交于 2019-12-19 03:55:15
问题 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 AbstractIndexedRepo implements RegistryPlugin, Plugin, RemoteRepositoryPlugin, IndexProvider, Repository { ... protected String name = this.getClass().getName(); ... Unfortunately Scala 2.9.2 compiler stops with an error: .../FixedIndexedRepository.scala

How can I fix the missing implicit value for parameter ta: TildeArrow in a test spec

放肆的年华 提交于 2019-12-18 14:15:41
问题 I'm working on a simple test spec using spray and I can't get it to compile correctly, don't know if I'm doing anything wrong. My version of scala is 2.9.3 and spray 1.0.1 (Updating either of them is not a suitable option). Here's my test spec's code: import org.specs2.mutable.Specification import spray.testkit.Specs2RouteTest import spray.http._ import akka.util.Duration import java.util.concurrent.TimeUnit import service.MyProxy abstract class MyTestSpec extends Specification with

What is the === (triple-equals) operator in Scala Koans?

浪子不回头ぞ 提交于 2019-12-18 11:38:22
问题 I started working my way through the Scala Koans, which is organized around a suite of unit tests with blanks that one needs to fill in. (This idea was modeled after a similar Ruby Koans project.) You start the sbt tool running a test, and it admonishes: [info] + ***************************************** [info] + [info] + [info] + [info] + Please meditate on koan "None equals None" of suite "AboutEmptyValues" [info] + [info] + [info] + [info] + ***************************************** ...and

Using Scala's ObservableMap

♀尐吖头ヾ 提交于 2019-12-13 14:13:46
问题 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 or is subscribe being called incorrectly? This is on 2.9.0.final scala> import scala.collection.mutable._ import scala.collection.mutable._ scala> import scala.collection.script._ import scala.collection.script._ scala> class MyMap extends HashMap

Strange behavior of Set4 in scala 2.9.1?

橙三吉。 提交于 2019-12-12 09:35:44
问题 Making a migration from 2.8.1 to 2.9.1 found interesting thing. Tried to write this in console: >>import collection.immutable.Set.Set4 >>new Set4[Int](1,2,3,4) It gives: java.lang.Error: Unexpected New at scala.tools.nsc.symtab.SymbolTable.abort(SymbolTable.scala:34) at scala.tools.nsc.backend.icode.GenICode$ICodePhase.scala$tools$nsc$bac .......................... That entry seems to have slain the compiler. Shall I replayscala:660) your session? I can re-run each line except the last one

how to allow passing in a => AnyRef function and call that function

烈酒焚心 提交于 2019-12-11 12:34:49
问题 I have the following code class LazyLogRecord( level: javalog.Level, messageGenerator: => AnyRef ) extends LogRecord(level, "") { // for each logged line, generate this string only once, regardless of how many handlers there are: override lazy val getMessage : String = messageGenerator().toString } This code does not compile because I try to invoke messageGenerator. I can modify the code from messageGenerator: => AnyRef to messageGenerator: () => AnyRef but then my upstream code log.debug("hi

Is this a bug in scala 2.9.0.1 actor library

亡梦爱人 提交于 2019-12-10 04:21:10
问题 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 { case "hello" => val s = sender reactWithin(2000){ case i:Int => s ! "hello" case TIMEOUT => s ! "TIMEOUT" } case _ => } } } } object A1 extends Actor { def act = { loop { react { case m:String => println (A2 !? (1000, m)) case _ => } } } } A1.start A2.start A1

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

梦想与她 提交于 2019-12-07 09:18:10
问题 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 = "Kanutten" } class KlassWithKnoll extends SuperTrait { def getKnall = "Mars" } val qsc = classOf[KlassWithKnoll] val knollGetter = qsc.getDeclaredMethod("getKnoll") println("isVolatile: " + Modifier.isVolatile(knollGetter.getModifiers())) This prints