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.

learn more… | top users | synonyms

5
votes
4answers
473 views

Do resumable exceptions make any sense?

Following up my previous question I wonder if resumable exceptions make any sense. It looks like nobody uses them in Java. Don't they use resumable exceptions because of Java limitations or just ...
-1
votes
0answers
54 views

Should I stick with flask or port to Django? [on hold]

I started my project with flask and mongodb for the purposes of rapid prototyping. I love flask/mongodb and have been successful with it so far. At this point, my application is growing in complexity. ...
1
vote
2answers
55 views

Parameterless & Empty-Paren methods in Scala

I'm learning Scala at the moment via Odersky's Programming Scala (2nd). I'm upto chapter 10 where he starts introducing parameterless and empty-paren methods. I just can't get my head around it. So ...
5
votes
2answers
448 views

What is the difference between self-types and trait inheritance in Scala?

When Googled, many responses for this topic come up. However, I don't feel like any of them do a good job of illustrating the difference between these two features. So I'd like to try one more time, ...
13
votes
4answers
2k views

Does functional programming add complexity in code? [closed]

For the entire past year I've been written Scala code (coming from a Java background). I really liked how you could create simpler and cleaner code, with vals, case classes, map/filter/lambda ...
10
votes
4answers
5k views

How Scala Developers Are Being Interviewed [closed]

How are Scala programmers being interviewed? What are the aspects that the interviewer looks for when interviewing a Scala developer?
6
votes
5answers
1k views

What negative consequences can arise from this language design rule?

Clarification: the rule is meant to prevent accessing variables that are not declared yet. Clarification 2: the rule mandates that the compiler follows calls to functions which are defined in the ...
20
votes
4answers
3k views

Is Clojure, Scala and other restrained by the JVM vs CLR

The Java implementors seem slow to adopt language improvements, for example compare C# with full closures, expression trees, LINQ etc.. to Java, and even the push back of some stuff to Java 8 will ...
0
votes
1answer
54 views

Preferred Scala code style for several embedded brace sets

I was wondering the correct way to format a situation such as this, where I have a def, a foreach and an if clause all nested, requiring braces. Currently I find it hard to read, and there is no ...
4
votes
1answer
140 views

Passing a Scala function to a Java 8 method

The following Scala code works and can be passed to a Java method expecting a function. Is there a cleaner way to do this? Here's my first pass: val plusOne = new ...
4
votes
3answers
1k views

Why Big Data Needs To Be Functional?

I started working on a new project lately related to Big Data for my internship. My managers recommended to start learning functional programming (They highly recommended Scala). I had a humbled ...
13
votes
3answers
2k views

When is it NOT good to use actors in akka/erlang?

I've been working with akka for 7-8 months now daily. When I started, I would be working on applications and notice that actors would be used basically anywhere once inside the actor system for ...
1
vote
1answer
350 views

JSON Library - Jackson or Play Framework? [closed]

Working on a Java and Scala code-base, there's a debate about whether to use Java's Jackson JSON or the Play Framework's JSON Library. After reading the Play JSON Docs, as well as Chapter 9 (JSON) of ...
23
votes
6answers
2k views

How do you encode Algebraic Data Types in a C#- or Java-like language?

There are some problems which are easily solved by Algebraic Data Types, for example a List type can be very succinctly expressed as: data ConsList a = Empty | ConsCell a (ConsList a) consmap f ...
8
votes
4answers
594 views

Design in “mixed” languages: object oriented design or functional programming?

In the past few years, the languages I like to use are becoming more and more "functional". I now use languages that are a sort of "hybrid": C#, F#, Scala. I like to design my application using ...
3
votes
1answer
78 views

Understanding special Scala syntax

I can understand this: List("one word", "another word") unzip (_ span (_ != ' ')) But don't get what's happening here below in the span. span takes a predicate and I think the braces can be omitted ...
1
vote
2answers
456 views

Learning Scala, feeling discouraged [closed]

I'm coming from a Java background and trying to learn Scala. At the moment I'm feeling pretty overwhelmed, there seems to be so much more to learn with Scala, so many different ways of doing the same ...
0
votes
1answer
58 views

Scala class with constructor requiring parameter of the same Class type

I can't remember but recently in one of the APIs I saw something like this class A (member:A){}. Scala does support it and there is no problem creating such a class but how do we initiate it and what ...
2
votes
6answers
439 views

How do you move beyond code examples without a project?

I am currently learning Scala and I find a mental blog of how to proceed to a degree where I can use Scala daily beyond the normal examples. I just do not have a particular project in mind of what I ...
8
votes
3answers
3k views

Functional Programming approach for a simplified game using Scala and LWJGL

I, a Java imperative programmer, would like to understand how to generate a simple version of Space Invaders based on Functional Programming design principles (in particular Referential Transparency). ...
6
votes
4answers
680 views

Why does Scala use the '_' operator for package import instead of '*' as in Java?

In my opinion, one of the greatest things about Scala is its interoperability with Java and its similar syntax. One thing that I found strange is the use of the _ operator for package wilcard imports ...
1
vote
2answers
138 views

Is short-circuit evaluation a consequence of call-by-name?

If the boolean operators &&, || are implemented as infix methods, then isn't short-circuit evaluation just a consequence of being implemented using call-by-name semantics, since, for example, ...
-1
votes
1answer
282 views

Why the Scala fascination with flatmap? (This doesn't seem to be the same for mapcat in the Clojure world) [closed]

In the Scala community - there is an apparent fascination with the FlatMap function. Now I understand that FlatMap is significant because it is used for the bind part of a Monad. (and that the ...
6
votes
1answer
349 views

Why appending to a list in Scala should have O(n) time complexity?

I am learning Scala at the moment and I just read that the execution time of the append operation for a list (:+) grows linearly with the size of the list. Appending to a list seems like a pretty ...
-6
votes
3answers
552 views

Are Extension methods (C#) and categories (Objective-C) the same as traits? [closed]

According to: Something similar to Objective-C categories in other languages? Static extension methods in C# are basically the same thing as Objective-C categories, so I'm going to lump these two ...
8
votes
2answers
775 views

How is Nothing a subtype of every other type in Scala

I am taking Martin Odersky's coursera course on functional programming with scala, and for now I have learned two things that together don't make sense: Scala doesn't support multiple inheritance ...
2
votes
1answer
245 views

Is there a representation for mixins or traits on UML?

Is there a representation for modern programming constructs that are becoming common in modern OOP/hybrid languages like mixins/traits/categories/partial classes ?
12
votes
1answer
805 views

Scala as a language for Generic Programming

In the paper “An Extended Comparative Study of Language Support for Generic Programming” by Garcia et al. an interesting comparison of programming languages features for generic programming is given: ...
18
votes
8answers
7k views

Why was Scala not implemented with C or C++

Does anybody know why was Scala implemented in Java and .NET instead of C or C++? Most languages are implemented with Cor C++ [i.e Erlang, Python, PHP, Ruby, Perl]. What are the advantages for Scala ...
4
votes
1answer
275 views

What kind of problems is an Android beginner likely to encounter in using Scala?

I am a hobbyist programmer who makes and maintains one production system, largely coded in Python, which now has to be ported to Android. I don't know Java at all. However, SL4A in Android makes ...
-3
votes
2answers
210 views

Am I barking up the wrong tree with Scala? [closed]

Having some spare time, I've decided to learn a new programming language while developing - for fun, will never see the light of day - an insurance administration web application (insurance is the ...
6
votes
2answers
774 views

Node.JS or Scala for mobile and web apps

I am coming from a php background with some python as well. I want to start working on a different language for both web and mobile development. I am also interested in real time apps dealing with ...
2
votes
3answers
170 views

How to name nested function?

When you have a function that wraps another one in Scala. What do you call the nested function? I found this : def factorial(i: Int): Int = { def fact(i: Int, accumulator: Int): Int = { if ...
2
votes
3answers
454 views

Does macros support make Scala a Lisp dialect?

I've read recently that macro support in Scala is now official. I checked the documentation page and they are reminiscent to the LISP ones. In one of his essays Paul Graham writes that when "you add ...
2
votes
4answers
252 views

How to promote Scala to the management?

As a developer I like Scala and could tell the management about technical benefits of the language. But even if management understands that a superior technology has business impact, I fear that they ...
2
votes
2answers
470 views

Should I use semicolons to delimit Scala statements?

I'm used to delimit statements by a semicolon from Java, so naturally I do it in Scala code too. I also feel that the code is easier to read, because it's evident where one statement ends and another ...
7
votes
1answer
566 views

Why is the Scala Option type not called Maybe, just as in Haskell?

Why is the Scala Option type not called Maybe, just as in Haskell? Maybe makes a lot more "semantic sense" to me, but maybe Option has different behaviour I am not aware of. Is there any particular ...
4
votes
4answers
400 views

Big switching from one platform to another [closed]

As an example I want to switch from C#/.NET to Scala/Jvm. I'm working as a self-employed and I'm free to choose my favorite language/platform. Having more than 8 years of experience in C#/.NET leads ...
9
votes
4answers
2k views

What is the difference between a Future and a Promise?

What is the difference between a Future and a promise? (In Akka and Gpars.) They look the same to me as both block and return the value of the future when get is called and a promise is to get the ...
2
votes
1answer
452 views

Is it worthwile to learn/use Play framework (for Scala or Java) if I don't use the MVC in it

I prefer Single Page Application to server side generated HTML. I am sensible to the pitch of "high productivity" delivered by Play. Now if I don't use the HTML generation part, is it still ...
0
votes
2answers
542 views

How do I initialize a Scala map with more than 4 initial elements in Java?

For 4 or fewer elements, something like this works (or at least compiles): import scala.collection.immutable.Map; Map<String,String> HAI_MAP = new Map4<>("Hello", "World", ...
20
votes
6answers
3k views

Why these attempts to water down Scala with Xtend and Kotlin? [closed]

So now Eclipse has offered Xtend and JetBrains is offering Kotlin - both of which seem to be watered down versions of Scala. My question is why? I've played with Scala a bit and it's not that hard. ...
0
votes
1answer
144 views

Scala string interpolator: ad-hoc feature of general construct?

In Scala 2.10 a new string interpolator feature has been added (see here). For example val name = "James" println(s"Hello, $name") // Hello, James What is not clear to me is whether this feature ...
6
votes
5answers
3k views

Is Clojure's syntax really simpler than Scala's? [closed]

Argument which is always made in favour of Clojure is that. The syntax is simpler and there is only one way of expressing code with no complicated rules. However Scala has loads of different types ...
2
votes
4answers
1k views

What are the practical benefits of LISP like syntax which Clojure uses over Java like syntax of Scala?

I spent couple of months learning Scala and got overwhelmed by number of different constructs it had, After looking at partial functions, partially-applied functions, pattern matching, actor syntax, I ...
66
votes
6answers
7k views

What's the difference between Scala and Red Hat's Ceylon language?

Red Hat's Ceylon language has some interesting improvements over Java: The overall vision: learn from Java's mistakes, keep the good, ditch the bad The focus on readability and ease of learning/use ...
4
votes
2answers
251 views

How are Scala Traits implemented in the JVM?

I have been reading about traits in Scala. They are pretty amazing. I am curious how they extend a class without actually resulting in multiple inheritance. I know that the JVM doesn't support ...
35
votes
8answers
2k views

Is memory management in programming becoming an irrelevant concern?

Background I revisited an old (but great) site I had not been to for ages - the Alioth Language Shootout (http://benchmarksgame.alioth.debian.org/). I started out programming in C/C++ several years ...
28
votes
5answers
12k views

Performance of Scala compared to Java

First of all I would like to make it clear that this is not a language-X-versus-language-Y question to determine which is better. I have been using Java for a long time and I intend to keep using it. ...
26
votes
5answers
11k views

Is Groovy going away? [closed]

I am sure this question has been asked many times. However, I like to ask it again with the intention of what is the future of these languages. I was first introduced to Groovy and really liked it. I ...