Have the best of both worlds. Construct elegant class hierarchies for maximum code reuse and extensibility, implement their behavior using higher-order functions. Or anything in-between.
Learn More
click the boxes below to see Scala in action!
Scala runs on the JVM, so Java and Scala stacks can be freely mixed for totally seamless integration.
So the type system doesn’t feel so static. Don’t work for the type system. Let the type system work for you!
Use data-parallel operations on collections, use actors for concurrency and distribution, or futures for asynchronous programming.
Combine the flexibility of Java-style interfaces with the power of classes. Think principled multiple-inheritance.
Think “switch” on steroids. Match against class hierarchies, sequences, and more.
Functions are first-class objects. Compose them with guaranteed type safety. Use them anywhere, pass them to anything.
or visit the Scala Documentation
One thing that really excites me about being part of the core group of developers working on Dotty is my chance to impact usability. A lot of thought has gone into designing Dotty to be as fast and structurally sound as possible. Now comes the next step - adding a new level of usability for the compiler and the surrounding tools.
We’ve looked at how other modern languages like Elm and Rust handle compiler warnings and error messages, and come to realize that Dotty is actually in great shape to provide comprehensive and easy to understand error messages in the same spirit.
Let’s dive right into some examples, let’s say you have this code:
try {
foo()
}
It doesn’t really make sense to put this in a try-block for two reasons:
catch or finally clauseSo let’s say we compile this file using scalac, we get something like:
test.scala:2: warning: A try without a catch or finally is equivalent to putting
its body in a block; no exceptions are handled.
try {
^
one warning found
This is helpful, but it has a couple of drawbacks:
catch or finally blocks - we don’t know how to
solve this (yes I know, most people do know what these are but - toy
example!)So what do you get with Dotty? This:

All errors are now visually separated, and the output is colorized so that you can find your mistakes quickly.
Another one of our goals is to be able to properly explain things when asked.
As such, if you pass the flag -explain when compiling the example above,
you’ll get a more verbose explanation:

Sometimes, especially when you’re in a rush - you might mistype some members. Currently we offer you the following support when selecting on a type:
class Foo {
def bar = ???
}
val foo = new Foo()
foo.barr
Will yield:

In the future we want to be able to offer you these types of suggestions on other things like missing imports.
Sometimes when working with complex types - it’s hard to see exactly where the error occurs. The Dotty compiler will in these cases give you a colored diff:

It will not do this however if the differences are huge - but it will syntax highlight the found and expected type anyway.
To make the transition to these new error messages as quick and pain-free as possible - we need help! This is a perfect entry-point into hacking on the compiler as you’ll need to create semantic objects that contain the relevant information for the error or warning.
So - this is what you do: