<commit_before>---
layout: blog-page
title: Announcing Dotty 0.12.0-RC1
author: <NAME>
authorImg: /images/aggelos.jpg
date: 2019-01-21
---

Happy New Year to all with the first release of Dotty for 2019! ✨🎊🎉

Today we are excited to release the version 0.12.0-RC1 of the Dotty compiler. 
This release serves as a technology preview that demonstrates new language features and the
compiler supporting them.

Dotty is the project name for technologies that are considered for inclusion in Scala 3. Scala has
pioneered the fusion of object-oriented and functional programming in a typed setting. Scala 3 will
be a big step towards realising the full potential of these ideas. Its main objectives are to

- become more opinionated by promoting programming idioms we found to work well,
- simplify where possible,
- eliminate inconsistencies and surprising behaviours,
- build on strong foundations to ensure the design hangs well together,
- consolidate language constructs to improve the language’s consistency, safety, ergonomics, and
  performance.

You can learn more about Dotty on our [website](https://dotty.epfl.ch).

<!--more-->

This is our 12th scheduled release according to our
[6-week release schedule](https://dotty.epfl.ch/docs/usage/version-numbers.html).

## What’s new in the 0.12.0-RC1 technology preview?

### Extension Methods

We are excited to announce that extension methods are now offered through dedicated language support!
Extension methods allow one to add methods to a type after the type is defined and up until now they were encoded through the powerful mechanism of implicits. 
Previously, one had to place the desired method in the trait with the receiver object to extend, as part of the parameter list. 
The infix-ness of the method was being restored by manually writing the implicit class, resolving `implicitly` that extended object. 

Now, in Dotty we can express an extension method by writing the method and prepending its name with the type to be extended. 

```scala
case class Circle(x: Double, y: Double, radius: Double)

def (c: Circle) circumference: Double = c.radius * math.Pi * 2
```

Read the [relevant documentation](https://dotty.epfl.ch/docs/reference/other-new-features/extension-methods.html) about generic extension methods, higher-kinded extension methods and more.

### TASTy Reflect goodies<commit_msg>Clarify blog post about extension methods<commit_after>---
layout: blog-page
title: Announcing Dotty 0.12.0-RC1
author: <NAME>
authorImg: /images/aggelos.jpg
date: 2019-01-21
---

Happy New Year to all with the first release of Dotty for 2019! ✨🎊🎉

Today we are excited to release the version 0.12.0-RC1 of the Dotty compiler. 
This release serves as a technology preview that demonstrates new language features and the
compiler supporting them.

Dotty is the project name for technologies that are considered for inclusion in Scala 3. Scala has
pioneered the fusion of object-oriented and functional programming in a typed setting. Scala 3 will
be a big step towards realising the full potential of these ideas. Its main objectives are to

- become more opinionated by promoting programming idioms we found to work well,
- simplify where possible,
- eliminate inconsistencies and surprising behaviours,
- build on strong foundations to ensure the design hangs well together,
- consolidate language constructs to improve the language’s consistency, safety, ergonomics, and
  performance.

You can learn more about Dotty on our [website](https://dotty.epfl.ch).

<!--more-->

This is our 12th scheduled release according to our
[6-week release schedule](https://dotty.epfl.ch/docs/usage/version-numbers.html).

## What’s new in the 0.12.0-RC1 technology preview?

### Extension Methods

We are excited to announce that extension methods are now offered through dedicated language support!
Extension methods allow one to add methods to a type after the type is defined.
This is done by writing a method with a parameter for the type to be extended
_on the left-hand side_ of the method name:

```scala
case class Circle(x: Double, y: Double, radius: Double)

def (c: Circle) circumference: Double = c.radius * math.Pi * 2
```

Extension methods are enabled when they are syntactically in scope (as above),
or when their enclosing instance is present in the implicit scope of the type that they extend,
as we exemplify below.

Extension methods were previously encoded in a rather roundabout way via the implicit class pattern.
Such encoding required a lot of boilerplate, especially when defining type classes.
In Dotty, this is no longer the case,
and type classes with infix syntax become very straightforward to define!
For example, consider:

```scala
trait Semigroup[T] {
  def (x: T) combine (y: T): T
}
implicit val IntSemigroup: Semigroup[Int] = new {
   def (x: Int) combine (y: Int): Int = x + y
}
implicit def ListSemigroup[T]: Semigroup[List[T]] = new {
   def (x: List[T]) combine (y: List[T]): List[T] = x ::: y
}
1.combine(2) // == 3
List(1,2).combine(List(3,4)) // == List(1,2,3,4)
```

This works because the `combine` extension methods of `IntSemigroup` and `ListSemigroup` are available
from the relevant implicit scopes.

Read the [full documentation](https://dotty.epfl.ch/docs/reference/other-new-features/extension-methods.html) about generic extension methods, higher-kinded extension methods, and more.

### TASTy Reflect goodies
{'fraction_non_alphanumeric': 0.07409460458240946, 'fraction_numerical': 0.014227642276422764, 'mean_word_length': 4.506612410986775, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6958577', 'n_tokens_mistral': 1542, 'n_tokens_neox': 1435, 'n_words': 734}