Scala was designed to be both object-oriented and functional. It is a pure object-oriented language in the sense that every value is an object. Objects are defined by classes, which can be composed using mixin composition. Scala is also a functional language in the sense that every function is a value. Functions can be nested, and they can operate on data using pattern matching.Earlier this year, Ted Neward also picked up on the "Ruby-esque" features of Scala and made three detailed blog entries introducing Scala, demonstrating it's brevity, and explaining it's object oriented design.
Key features, from the Scala homepage:
According to Martin, Scala has a small but growing community. "We currently see about 1000 downloads per month of the Scala distribution on our website." Scala 2.1.2 was released this past April.
- Scala is object-oriented. Scala is a pure object-oriented language in the sense that every value is an object. Types and behavior of objects are described by classes and traits. Class abstractions are extended by subclassing and a flexible mixin-based composition mechanism as a clean replacement for multiple inheritance.
- Scala is functional. Scala is also a functional language in the sense that every function is a value. Scala provides a lightweight syntax for defining anonymous functions, it supports higher-order functions, it allows functions to be nested, and supports currying. Scala's case classes and its built-in support for pattern matching model algebraic types used in many functional programming languages. Furthermore, Scala's notion of pattern matching naturally extends to the processing of XML data with the help of right-ignoring sequence patterns. In this context, sequence comprehensions are useful for formulating queries. These features make Scala ideal for developing applications like web services (external link).
- Scala is statically typed. Scala is equipped with an expressive type system that enforces statically that abstractions are used in a safe and coherent manner. In particular, the type system supports, generic classes, variance annotations, upper and lower type bounds, inner classes and abstract types as object members, compound types, explicitly typed self references, views, and polymorphic methods. A local type inference mechanism takes care that the user is not required to annotate the program with redundant type information. In combination, these features provide a powerful basis for the safe reuse of programming abstractions and for the type-safe extension of software.
- Scala is extensible. The design of Scala acknowledges the fact that in practice, the development of domain-specific applications often requires domain-specific language extensions. Scala provides a unique combination of language mechanisms that make it easy to smoothly add new language constructs in form of libraries: any method may be used as an infix or postfix operator, and closures are constructed automatically depending on the expected type (target typing). A joint use of both features facilitates the definition of new statements without extending the syntax and without using macro-like meta-programming facilities.
Community comments
Scala is cool
by Jason Carreira,
Hmm without all the "end"s it looks like Python to me
by Todd G,
Re: Entity escape issue in comment subject lines
by Todd G,
JVM bytecodes
by Binil Thomas,
Re: [OT] Haskell -
by Dan Diephouse,
Re: [OT] Haskell -> JVM bytecodes
by James Shipley,
And so on.....
by ivan orero,
Re: And so on.....
by Roger Pack,
Scala is cool
by Jason Carreira,
Your message is awaiting moderation. Thank you for participating in the discussion.
I started picking up Scala earlier this year around when Ted did, and it's definitely cool... I haven't had as much time as I'd like to dig in, and I got sidetracked on other functional programming topics like Monads, but I'm trying to make time to play with it some more.
The functional stuff is definitely nice as it allows for some very concise code to do powerful things. I'm still finding it a bit tough to read compared to Java, though. Partly it's because I'm so used to Java, but partly it's because Scala is just more powerful and somewhat more complex.
Hmm without all the "end"s it looks like Python to me
by Todd G,
Your message is awaiting moderation. Thank you for participating in the discussion.
Okay I'm trolling a bit but I couldn't help myself. For my eyes the "end" keywords everywhere in Ruby visually distinguish it from Python at a quick glance. Otherwise they're so similar it's hard to tell at a [very] quick glance. But I sense Ruby-colored glasses around these parts ;-)
Re: Entity escape issue in comment subject lines
by Todd G,
Your message is awaiting moderation. Thank you for participating in the discussion.
See subject!
JVM bytecodes
by Binil Thomas,
Your message is awaiting moderation. Thank you for participating in the discussion.
While, we are on FP, does anyone know of a Haskell compiler that can generate JVM bytecodes?
Re: [OT] Haskell -
by Dan Diephouse,
Your message is awaiting moderation. Thank you for participating in the discussion.
Its not haskell per se, but I did see this: jaskell.codehaus.org/
Re: [OT] Haskell -> JVM bytecodes
by James Shipley,
Your message is awaiting moderation. Thank you for participating in the discussion.
Check out LambdaVM - The Haskell to Java Translator
And so on.....
by ivan orero,
Your message is awaiting moderation. Thank you for participating in the discussion.
Ruby is slow. Scala It is slow compared to Java and Java is slow compared to C and C is slow compared to well written assembly language....
Re: And so on.....
by Roger Pack,
Your message is awaiting moderation. Thank you for participating in the discussion.
looks to me like scala isn't slow compared to java. shootout.alioth.debian.org/u32/scala.php