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

What is a TypeTag and how do I use it?

All I know about TypeTags is that they somehow replaced Manifests. Information on the Internet is scarce and doesn't provide me with a good sense of the subject. So I'd be happy if someone shared a link to some useful materials on TypeTags including…
Sergey Weiss
  • 5,944
  • 8
  • 31
  • 40
182
votes
1 answer

Getting a structural type with an anonymous class's methods from a macro

Suppose we want to write a macro that defines an anonymous class with some type members or methods, and then creates an instance of that class that's statically typed as a structural type with those methods, etc. This is possible with the macro…
Travis Brown
  • 138,631
  • 12
  • 375
  • 680
82
votes
1 answer

Scala generic method - No ClassTag available for T

I'm relatively new to Scala and am trying to define a generic object method. However, when I refer to the parameterized type within the method I am getting "No ClassTag available for T". Here is a contrived example that illustrates the…
Chuck
  • 1,850
  • 2
  • 17
  • 28
80
votes
5 answers

Scala - What is the difference between size and length of a Seq?

What is the difference between size and length of a Seq? When to use one and when the other? scala> var a :Seq[String] = Seq("one", "two") a: Seq[String] = List(one, two) scala> a.size res6: Int = 2 scala> a.length res7: Int = 2 It's the…
YoBre
  • 2,520
  • 5
  • 27
  • 37
75
votes
1 answer

Use case of scala.concurrent.blocking

I came across the scala.concurrent.blocking method, and according to the Scala documentation this is... Used to designate a piece of code which potentially blocks, allowing the current BlockContext to adjust the runtime's behavior. Properly marking…
Sourav Chandra
  • 952
  • 2
  • 7
  • 11
72
votes
1 answer

Documenting Scala 2.10 macros

I'll start with an example. Here's an equivalent of List.fill for tuples as a macro in Scala 2.10: import scala.language.experimental.macros import scala.reflect.macros.Context object TupleExample { def fill[A](arity: Int)(a: A): Product = macro…
Travis Brown
  • 138,631
  • 12
  • 375
  • 680
63
votes
3 answers

Scala's "postfix ops"

I've searched for a half-hour, and still cannot figure it out. In SIP: Modularizing Language Features there are a number of features which will require explicit "enabling" in Scala 2.10 (import language.feature). Amongst them there is postfixOps, to…
dmitry
  • 4,989
  • 5
  • 48
  • 72
50
votes
4 answers

String interpolation in Scala 2.10 - How to interpolate a String variable?

String interpolation is available in Scala starting Scala 2.10 This is the basic example val name = "World" //> name : String = World val message = s"Hello $name" //> message : String = Hello World I was wondering if there is a…
Eran Medan
  • 44,555
  • 61
  • 184
  • 276
49
votes
2 answers

How do you update multiple columns using Slick Lifted Embedding?

How do you update multiple columns using Slick Lifted Embedding ? This document doesn't say much. I expected it to be something like this Query(AbilitiesTable).filter((ab: AbilitiesTable.type) => ab.id === ability_id).map((ab: AbilitiesTable.type)…
expert
  • 29,290
  • 30
  • 110
  • 214
48
votes
4 answers

What is coming up for scala in 2.10?

Obviously there is the reflection library but what else can we expect to see in the next release of scala? Any language changes? Is there a website where I can see a roadmap?
oxbow_lakes
  • 133,303
  • 56
  • 317
  • 449
45
votes
1 answer

Generating a class from string and instantiating it in Scala 2.10

In Scala 2.10 how do I generate a class from string (probably, using the Toolbox api) later to be instantiated with Scala's reflection?
Nikita Volkov
  • 42,792
  • 11
  • 94
  • 169
43
votes
2 answers

What is scala's experimental virtual pattern matcher?

I've seen quite a few mentions recently of the new "virtualized" pattern matcher for scala. I missed the memo explaining what it actually was...
oxbow_lakes
  • 133,303
  • 56
  • 317
  • 449
42
votes
1 answer

Static return type of Scala macros

So I've got this macro: import language.experimental.macros import scala.reflect.macros.Context class Foo class Bar extends Foo { def launchMissiles = "launching" } object FooExample { def foo: Foo = macro foo_impl def foo_impl(c: Context):…
Travis Brown
  • 138,631
  • 12
  • 375
  • 680
41
votes
4 answers

How to disambiguate links to methods in scaladoc?

I'm documenting a Scala class with overloaded methods. How can I distinguish them when referring to them in scaladoc comments? For example, if I have /** * The most important method is [[Doc.foo]]. */ object Doc { def foo[A]: A = throw new…
Petr
  • 62,528
  • 13
  • 153
  • 317
40
votes
7 answers

Scala: Parse JSON directly into a case class

Given a string of JSON, and a case class that corresponds to it, what's a simple way to parse the JSON into the case class? There are many libraries available, but it seems that Scala might now do this out of the box. What about if the JSON should…
SRobertJames
  • 8,210
  • 14
  • 60
  • 107
1
2 3
39 40