7 ms·
Most of the comments here talk about how whatever useful can be done in Scala can be done in some other language. That is not the point, Scala is a good languag
by codelion 15y ago
Most of the comments here talk about how whatever useful can be done in Scala can be done in some other language. That is not the point, Scala is a good language because
- Compatible with JVM
- Strong type system
- Linear Typing
- Substructal Types
- Local Type inference
- Concurrency constructs built in as actors (Akka)
- Integration of OO and functional paradigms
- Supports Higher Order Programming
- defn-site Variance based Parametric Polymorphism
- Mixin Class Composition for finer grain reuse
- Traits provide stackable behaviors (aspect-oriented style)
- Embedded Polymorphic Domain Specific Language (DSL)
using dependent path types
Every language design is a trade off, but Scala is more expressive and concise than Java. Sometimes that may look to you as code which is unreadable. Other languages like clojure make some other trade offs. But Scala tries to bring some of the benefits of functional programming (in say Haskell) to Java.
- timclark 15y agoIs it easy for programmers of all abilities to understand and use? Will I still understand my own code in 9 months time? I think that their is more to being a good language than a list of features.
- soc88 15y agoYes, yes and yes.
- dkhenry 15y ago>Is it easy for programmers of all abilities to understand and use? Thats a loaded question. I don't know about you but I have met alot of People who write VBScript in excel spreadsheets that call themselfes programmers. To say the language is bad because programmers of all abailities can't understand and use it will make all languages even the simplisest ones fail that test. You should be asking can programmers that I will be asked to work with understand it and use it, however your answer to that question I think will say more about the programmers you hire / work with then it will about scala.
- codelion 15y agoThe list of features were meant to just illustrate that Scala is not some programming fad, it is strictly more expressive than Java and based on solid programming language principles. Although,I agree the code may not be easy to understand for everyone in the beginning but with effort and training I believe every programmer can learn enough of it to be more productive.
- timclark 15y agoWhat can you express in Scala that you can't express in Java?
- trurl 15y agoYou do realize the futility of such questions given Turing completeness, right? It is not about what can be expressed, but about how you express things. You do not need function literals in Scala, but it is sure is more concise and cleaner than anonymous classes in Java. You do not need traits in Scala, but it avoids code duplication or the overhead of wrapper classes or proxies in Java. You do not need case classes and algebraic pattern matching in Scala, but it is far more concise and less error prone than having to write the obscene amounts of boilerplate you would write in Java. And so on.
- timclark 15y agoOk, so can I express that this method returns a collection of a single type and that collection always contains 10 items?
- trurl 15y agoYes, you can do that by using types indexed by a number. See https://apocalisp.wordpress.com/2010/06/16/type-level-programming-in-scala-part-4a-peano-number-basics/ https://apocalisp.wordpress.com/2010/06/16/type-level-progra... for one take on this.
- 15y ago
- channing 15y ago> Is it easy for programmers of all abilities to understand and use? I am working with two guys right now who have less than 8 months of programming experience. They are not having a problem with scala. They can do useful work in it. What they have a problem with is all the other stuff that you just have to learn about building systems.
- trurl 15y agoUnless there are some very recent experimental extensions that I have not heard about, Scala does not have support for linear or substructural typing. I suspect you are thinking of structural subtyping, which is a completely different concept.