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 ...
5
votes
2answers
31 views
Adding value to Scala map
Why does this work:
val x = Map[Int,Int]()
val y = (1, 0)
x + y
but not this?
val x = Map[Int,Int]()
x + (1, 0)
The error produced is:
<console>:11: error: type mismatch;
found : ...
2
votes
1answer
23 views
Simple Websocket in scala / akka / play
I would like to create a simple Websocket application using Scala / Akka / Play.
What I see from the examples (such as the webchat or the recent talk at the Scala Days), is a blend between JavaScript ...
0
votes
0answers
28 views
Use scala or groovy for Android Studio development
Android Studio is fresh new and nice get start with when developing android apps.
I'm curious is there some solution support using mix java code and groovy code or scala code together for one android ...
0
votes
1answer
36 views
a right-associative triple colon operator
Although a triple colon is a right-associative operator, the following result says it's not true, is it?
List(3, 4, 5) ::: List(18, 19, 20) //> List[Int] = List(3, 4, 5, 18, 19, 20)
From my ...
4
votes
0answers
32 views
How to test type conformance of higher-kinded types in Scala
I am trying to test whether two "containers" use the same higher-kinded type. Look at the following code:
import scala.reflect.runtime.universe._
class Funct[A[_],B]
class Foo[A : TypeTag](x: A) {
...
-5
votes
1answer
43 views
Which programming languages offer mature libraries for local & remote file access? [on hold]
I am planning a desktop and mobile app for file management. It needs access to all kinds of files, inclusive of files stored on other machines. Even treating database records as different files is an ...
0
votes
1answer
15 views
Multi-project dependency injection
Apologies for the vague question, but how is dependency injection typically handled in a multi-project environment? Each module should be able to define its own dependencies and ideally they would be ...
2
votes
1answer
43 views
Scripting with Scala: How to launch an uncompiled script?
Apart from serious performance problems, Scala is a very powerful language. Therefore I am now using it frequently for scripted tasks inside Bash. Is there a way to just execute a *.scala file exactly ...
0
votes
0answers
19 views
stateful protocol implementation with scala/akka
i'm currently implementing a TCP server with scala/akka using a stateful, text-based protocol including handshakes and some back-and-forth of strings to exchange data.
Considering I'm getting a ...
1
vote
1answer
31 views
Blacklist some method calls with Scala Compiler plugin
I wanted to create a scala compiler plugin that would prevents the call of some functions. For example System.exit.
The idea behind the scene is to let people write Scala scripts that would be ...
3
votes
2answers
49 views
Scala return statements in anonymous functions
Why does an explicit return statement (one that uses the return keyword) in an anonymous function return from the enclosing named function, and not just from the anonymous function itself?
E.g. the ...
1
vote
2answers
61 views
Traits for “static” methods in Scala?
Are there cases where it's preferable to mixin traits to access the functionality of "static" methods, rather than importing objects with those methods?
Say we want to access the functionality of a ...
1
vote
1answer
34 views
Scala Play 2.1: Accessing request and response bodies in a filter
I'm writing a filter to log all requests and their responses
object LoggingFilter extends EssentialFilter {
def apply(next: EssentialAction) = new EssentialAction {
def apply(rh: ...
0
votes
0answers
36 views
Scala SBT and JNI library
I am writing a simple app in Scala that uses a leveldb database through the leveldbjni library. My build.sbt file looks like this:
name := "Whatever"
version := "1.0"
scalaVersion := "2.10.2"
...
0
votes
0answers
21 views
Force decoding of Play2's play.api.libs.ws.Response to UTF-8 in Scala?
When I fetch content from the site http://dilbert.com, it gives me an invalid encoding: utf-8lias. No such encoding of course exists, but I cannot impact what the site tells me.
As a result of this, ...