Questions tagged [scala-2.10]

Version 2.10 of the Scala language for the JVM. Use only if your question is specifically related to features of this version.

This tag is for the 2.10 version of the Scala language. The contents of this version are not yet decided, as it has not yet been released.

Use only if your question is specifically related to features of this version. Just because you are using this version, doesn't mean you need this tag. Use in addition to or instead of this tag.

See for more information.

590 questions
9
votes
1 answer

How to reflect annotations in Scala 2.10?

I am trying to discover if a trait's value has an annotation associated to it. After reviewing the Scala 2.10-M7 reflection API I thought that the getAnnotations method (located in Symbol) could be a great candidate, but it is returning an empty…
neutropolis
  • 1,884
  • 15
  • 34
9
votes
1 answer

Can this free-term-variable error (produced at macro expansion) be avoided?

I am developing a DSL and I am getting a "free term" failure while expanding a macro. I would like to know if it can be avoided. I have simplified the problem to the following situation. Suppose we have this expression: val list = join { 0 1 …
neutropolis
  • 1,884
  • 15
  • 34
8
votes
1 answer

How to handle cross cutting concerns the Scala way

I am reading online about cross cutting concerns since I just implemented Log4j into my code. Some people are saying using AspectJ is okay, while others point out that it breaks functional programming. That mixins are Scala's solution for cross…
user1187135
8
votes
1 answer

How to make implicit conversion work during pattern matching

I have an enum for keywords and operators (and some other too), e.g. (all are similar): object Keywords extends Enumeration { val AND, ARRAY, BEGIN, ...= Value case class Keyword(keyword: Value) extends Token[Value] { def…
Joshua MN
  • 1,486
  • 2
  • 13
  • 26
8
votes
1 answer

How can I do aggregate queries in Slick?

For example, I have the following table definitions: object Houses extends Table[Long]("Houses") { def id = column[Long]("id") def * = id } object Rooms extends Table[(Long, Long)]("Rooms") { def id = column[Long]("id") def houseId =…
Rogach
  • 26,050
  • 21
  • 93
  • 172
8
votes
1 answer

Scala Reflection - Loading or finding classes based on trait

Does the scala reflection API (2.10) provide any easier means of searching the loaded classes and filtering the list to specific classes which implement a defined trait? ie; trait Widget { def turn(): Int } class Cog extends Widget { def…
Doswell
  • 418
  • 3
  • 11
8
votes
1 answer

Mocking overloaded method

I am using scalamock to mock a class that contains some overloaded methods but I am getting some errors. For example: val out = mock[PrintStream] (out.print _).expects("cmd \r\n") Raises the following error: [error]…
simao
  • 14,491
  • 9
  • 55
  • 66
8
votes
1 answer

How do you deserialize immutable collection using Kryo?

How do you deserialize immutable collection using Kryo ? Do I need to register something in addition to what I've done ? Here is my sample code import com.esotericsoftware.kryo.Kryo import com.esotericsoftware.kryo.io.Input import…
expert
  • 29,290
  • 30
  • 110
  • 214
8
votes
2 answers

Getting type information inside scala repl via IMain

Intent I am trying to add support for :kind command to scala repl. Thanks to Eugene Burmako, I was able to get a working prototype. Though it only works with fully qualified names and fails to resolve imported names. I am now trying to use…
George
  • 8,368
  • 12
  • 65
  • 106
8
votes
2 answers

How to distinguish compiler-inferred implicit conversion from explicitly invoked one?

Let's imagine passing these two equivalent expressions to a Scala macro: with compiler-inferred implicit conversion: 1+"foo" with explicitly invoked implicit conversion: any2stringadd(1)+"foo" Is there a way to distinguish between these two inside…
ghik
  • 10,706
  • 1
  • 37
  • 50
8
votes
2 answers

Manifest[T].erasure is deprecated in 2.10, what should I use now?

I have the following code: object Log { def get[T](implicit manifest : Manifest[T] ) = { LoggerFactory.getLogger( manifest.erasure.getName ) } def getByName( name : String ) = { LoggerFactory.getLogger(name) } } The idea is to…
Maurício Linhares
  • 39,901
  • 14
  • 121
  • 158
8
votes
2 answers

Scala 2.10 compiler takes 10x longer after first time in SBT

I'm updating some code from 2.9.1 to 2.10.0 (and I tried 2.10.1 with the same results), using SBT 0.12.1 in both cases. When I run sbt clean compile on the command line, they both complete after about 250 seconds. However, when I run sbt…
Mike
  • 1,839
  • 1
  • 17
  • 25
8
votes
1 answer

Is there a way to get proper report of runtime compilation errors in scala 2.10?

In scala 2.9.x I used tools.nsc.Global directly to compile certain string into a class and execute it. In scala 2.10, it is possible to replace it with something like the following: import scala.reflect.runtime._; val cm =…
Rogach
  • 26,050
  • 21
  • 93
  • 172
8
votes
2 answers

Scala 2.10 macros compared to what is available in Java

I don't know this field so much. Can someone explain what is possible in Scala 2.10 with macros, compared to what is possible in Java with compilation preprocessors, and tools like CGLIB, ASM, Byteman...?
Sebastien Lorber
  • 89,644
  • 67
  • 288
  • 419
8
votes
2 answers

Creating a method definition tree from a method symbol and a body

Is there a convenient way to turn a MethodSymbol into the left-hand side of a method definition tree (i.e., a DefDef) in Scala 2.10? For example, suppose I want to create a macro that will take an instance of a trait and wrap all of that trait's…
Travis Brown
  • 138,631
  • 12
  • 375
  • 680