Skip to content

Commit 8449cc5

Browse files
committed
Merge branch 'master' into issue-498
2 parents 02c2e3c + 3f55787 commit 8449cc5

17 files changed

+831
-126
lines changed

Gemfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
source 'https://rubygems.org'
22
gem 'jekyll', '3.1.6'
3-
gem 'json', '>= 1.8.3'
3+
gem 'json', '1.8.3'
44
gem 'kramdown', '1.11.1'
5-
gem 'mercenary', '>= 0.3.5'
6-
gem 'posix-spawn', '>= 0.3.11'
7-
gem 'yajl-ruby', '>= 1.2.1'
5+
gem 'mercenary', '0.3.5'
6+
gem 'posix-spawn', '0.3.11'
7+
gem 'yajl-ruby', '1.2.1'

Gemfile.lock

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ GEM
1616
sass (~> 3.4)
1717
jekyll-watch (1.5.0)
1818
listen (~> 3.0, < 3.1)
19-
json (2.0.2)
19+
json (1.8.3)
2020
kramdown (1.11.1)
2121
liquid (3.0.6)
2222
listen (3.0.8)
2323
rb-fsevent (~> 0.9, >= 0.9.4)
2424
rb-inotify (~> 0.9, >= 0.9.7)
25-
mercenary (0.3.6)
25+
mercenary (0.3.5)
2626
posix-spawn (0.3.11)
27-
rb-fsevent (0.9.7)
27+
rb-fsevent (0.9.8)
2828
rb-inotify (0.9.7)
2929
ffi (>= 0.5.0)
3030
rouge (1.11.1)
@@ -37,11 +37,11 @@ PLATFORMS
3737

3838
DEPENDENCIES
3939
jekyll (= 3.1.6)
40-
json (>= 1.8.3)
40+
json (= 1.8.3)
4141
kramdown (= 1.11.1)
42-
mercenary (>= 0.3.5)
43-
posix-spawn (>= 0.3.11)
44-
yajl-ruby (>= 1.2.1)
42+
mercenary (= 0.3.5)
43+
posix-spawn (= 0.3.11)
44+
yajl-ruby (= 1.2.1)
4545

4646
BUNDLED WITH
47-
1.13.5
47+
1.13.6

_config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
title: The Scala Programming Language
22

3-
scalaversion: "2.11.8"
4-
devscalaversion: "2.12.0-RC2"
3+
scalaversion: "2.12.0"
4+
devscalaversion: ""
55

66
baseurl: ""
77
markdown: kramdown

_layouts/downloadpage.html

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ <h3>Software Requirements</h3>
6666

6767
{{ page.requirements }}
6868

69+
{{ content }}
70+
6971
{% if page.show_resources == "true" %}
7072

7173
<div>
@@ -116,7 +118,9 @@ <h3 hidden>Other resources</h3>
116118

117119
</div>
118120

119-
{{ content }}
121+
<h3>License</h3>
122+
The Scala distribution is released under the <a href="{{ site.baseurl }}/license.html">3-clause BSD license</a>.
123+
120124

121125
<div id="getting-started-popup">
122126
<div class="popup">
@@ -129,4 +133,3 @@ <h3 hidden>Other resources</h3>
129133
</ul>
130134
</div>
131135
</div>
132-

_layouts/maindownloadpage.html

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,3 @@ <h3>Additional information</h3>
1717
<li><a href="changelog.html">Changelog</a></li>
1818
<li><a href="all.html">All previous Scala Releases</a></li>
1919
</ul>
20-
21-
<h3>License</h3>
22-
The Scala distribution is released under the <a href="{{ site.baseurl }}/license.html">3-clause BSD license</a>.
23-
24-
25-
{{ content }}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
---
2+
layout: blog
3+
post-type: blog
4+
by: Jon Pretty
5+
title: Lars Hupel Joins the Scala Center Advisory Board
6+
---
7+
8+
It has been almost half a year since we kicked off our first Scala Center
9+
Advisory Board meeting in New York. With a board primarily made up of
10+
commercial sponsors, we decided then to offer Bill Venners the role of
11+
community representative, and Bill has ably filled this role in the two
12+
meetings so far.
13+
14+
But since then, the sponsors have grown to nine, and to maintain a
15+
proportionate representation for the community on the board, we decided — with
16+
the sponsors' unanimous agreement — to invite a second community representative
17+
to attend and vote in meetings.
18+
19+
We decided to offer the choice of candidate to
20+
[Typelevel](http://typelevel.org/). This was a reflection of the incredible
21+
work Typelevel have done to nurture a friendly and open community of
22+
functionally-minded Scala users around a number of open-source projects. Their
23+
work is focussed around the Cats, Shapeless and Spire libraries, but has grown
24+
to include over a dozen other libraries, tools and compiler plugins, all with
25+
a shared philosophy.
26+
27+
Typelevel have been instrumental in helping to grow the Scala community, and
28+
the functional elements within it, through regular hacking sessions, and with a
29+
number of workshops and unconferences colocated with larger Scala events.
30+
31+
So we felt it was only appropriate — given Typelevel's influence, its track
32+
record, and the philosophy of welcomeness it shares with the Scala Center —
33+
that they should choose the second community representative to the Advisory
34+
Board.
35+
36+
When we spoke to Typelevel, in typical style, they opened [a GitHub
37+
issue](https://github.com/typelevel/general/issues/42) to discuss the
38+
invitation, to decide whether to accept it, and to choose a representative.
39+
We're very glad that they accepted, and selected Lars Hupel to sit on the Scala
40+
Center Advisory Board alongside Bill.
41+
42+
Lars has made a number of significant contributions to the Scala community in
43+
the last few years. His open-source contributions started with work as a
44+
maintainer of [Scalaz](https://github.com/scalaz/scalaz), but he has since
45+
worked on the code verification tool, [Leon](http://leon.epfl.ch/), and
46+
[libisabelle](http://lars.hupel.info/libisabelle/), which facilitates
47+
interacting with the proof assistant, Isabelle, from Scala. All this experience
48+
gives Lars a deep understanding of Scala, both as a language and through some
49+
of its the most advanced applications.
50+
51+
The Scala Center shall be very happy to welcome Lars, as one of the founders of
52+
Typelevel, to the Advisory Board, and at the next meeting (currently scheduled
53+
for late November) we shall put his appointment to the existing membership for
54+
approval. We have every expectation he will be a valuable asset to the board!
55+

blog/_posts/2016-10-24-scalafix.md

Lines changed: 215 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,215 @@
1+
---
2+
layout: blog
3+
post-type: blog
4+
by: Ólafur Páll Geirsson
5+
title: "Introducing Scalafix: a migration tool for Scalac to Dotty"
6+
---
7+
8+
I am excited to announce the first release of
9+
[scalafix](http://scalacenter.github.io/scalafix/), a new tool to
10+
prepare Scala 2.x code for [Dotty](http://dotty.epfl.ch/), a next
11+
generation Scala compiler. This effort follows the Scala Center Advisory
12+
Board proposal:
13+
["Clarification of Scala to Dotty migration path"](https://scala.epfl.ch/minutes/2016/06/06/may-9-2016.html#proposal-scp-002-clarification-of-scala-to-dotty-migration-path).
14+
15+
There is a lot to be excited over in Dotty,
16+
[faster compilation times](http://www.slideshare.net/Odersky/scala-days-nyc-2016),
17+
[faster+smaller binaries](https://d-d.me/talks/scaladays2015/#/) and
18+
[awesome error messages](http://www.scala-lang.org/blog/2016/10/14/dotty-errors.html)
19+
to name a few things. However, some Scala 2.x applications can't
20+
immediately enjoy these benefits due to several breaking changes in
21+
Dotty. Scalafix is part of our strategy to smoothen the migration
22+
process for those applications.
23+
24+
Scalafix takes care of easy, repetitive and tedious code transformations
25+
so you can focus on the changes that truly deserve your attention. In a
26+
nutshell, scalafix reads a source file, transforms usage of unsupported
27+
features into newer alternatives, and writes the final result back to
28+
the original source file. Scalafix aims to automate the migration of as
29+
many unsupported features as possible. There will be cases where
30+
scalafix is unable to perform automatic migration. In such situations,
31+
scalafix will point to the offending source line and provide
32+
instructions on how to refactor the code. The objective is that your
33+
Scala 2.x codebase gets up and running faster with Dotty.
34+
35+
What can scalafix do?
36+
-------------------------
37+
38+
Scalafix comes with a command line interface and an SBT plugin. Running
39+
scalafix is as simple as:
40+
41+
~~~
42+
# CLI
43+
scalafix Code.scala
44+
# SBT, after adding plugin to project/plugins.sbt
45+
sbt scalafix
46+
~~~
47+
48+
More detailed instructions on how to setup scalafix are on the
49+
[project website](http://scalacenter.github.io/scalafix/).
50+
51+
This initial release implements two rewrites: `ProcedureSyntax` and
52+
`VolatileLazyVal`. More rewrite rules are planned for future releases.
53+
54+
The `ProcedureSyntax` rewrite works like this:
55+
56+
~~~scala
57+
// before
58+
def main(args: Seq[String]) { // note lack of '='
59+
println("Hello scalafix!")
60+
}
61+
// after
62+
def main(args: Seq[String]): Unit = { // note ': Unit ='
63+
println("Hello scalafix!")
64+
}
65+
~~~
66+
67+
Dropping procedure syntax is part of a general effort in Dotty to
68+
simplify the Scala language.
69+
70+
The `VolatileLazyVal` rewrite adds a `@volatile` annotation to lazy vals,
71+
like this:
72+
73+
~~~scala
74+
lazy val x = ... // before
75+
@volatile lazy val x = ... // after
76+
~~~
77+
78+
With `@volatile`, Dotty uses a deadlock free scheme that is
79+
comparable-if-not-faster than the scheme used in scalac.
80+
81+
How does scalafix work?
82+
---------------------------
83+
84+
All the heavy-lifting behind scalafix happens in
85+
[scala.meta](http://scalameta.org/), a new metaprogramming toolkit
86+
aspiring to succeed scala.reflect. Scala.meta makes it easy to do
87+
non-trivial code transformations while preserving syntactic details in
88+
the original source file. This key attribute of scala.meta makes it
89+
suitable for both developer tools like scalafix as well as compile-time
90+
metaprograms like macros.
91+
92+
The grand vision of scala.meta is to provide a single interface to
93+
accomplish most common metaprogramming tasks in
94+
Scala.
95+
![scala.meta sketch]({{ site.baseurl }}/resources/img/scalameta-sketch.jpg)
96+
The idea is to untie metaprograms from compiler implementations, providing a
97+
platform-independent API that works both in the Scala compiler, Dotty
98+
and tools like IntelliJ IDEA. Metaprogram authors benefit from a
99+
user-friendly interface built on immutable ADTs and type classes.
100+
Compiler authors benefit from the fact that they don't need to expose
101+
compiler internals in order to support popular features like macros.
102+
103+
In scalafix, we use the scala.meta API to parse Scala source files,
104+
traverse abstract syntax trees, inspect tokens (including comments!) and
105+
then perform the minimum required transformations to the source file.
106+
Thanks to scala.meta dialects, which abstract away syntactic differences
107+
between variants of Scala, we can use the same programs to manipulate
108+
regular Scala source files, SBT files as well as code that uses new
109+
Dotty syntax such as union types and trait parameters. All this powerful
110+
functionality is implemented behind a minimalistic interface.
111+
The NonVolatileLazyVal
112+
[implementation](https://github.com/scalacenter/scalafix/blob/master/core/src/main/scala/scalafix/rewrite/VolatileLazyVal.scala)
113+
is 15 lines of code. It could comfortably fit in three tweets.
114+
115+
We would not be able to achieve this level of expressiveness with
116+
scala.reflect, the current standard metaprogramming framework for Scala.
117+
Why? To name a few reasons, scala.reflect does not preserve syntactic
118+
details such as comments and scala.reflect has no notions of dialects,
119+
so it is bound to only support Scala 2.x.
120+
121+
How does scalafix evolve?
122+
-----------------------------
123+
124+
As we have seen above, the functionality of scalafix heavily relies on
125+
the infrastructure provided by scala.meta. However, in order to write
126+
more sophisticated scalafix rewrite rules, there are two main features
127+
missing in scala.meta, namely a *scalac converter* and *semantic API*.
128+
We are closely collaborating with Eugene Burmako, the lead developer of
129+
scala.meta, in the development efforts of these two features.
130+
131+
### Scalac converter
132+
133+
The scalac converter is a key subsystem of scala.meta.
134+
For every Scala feature, the converter recognizes its representation in the Scala
135+
compiler and translates it into the corresponding data structures of the
136+
scala.meta API.
137+
138+
Over the last months, we’ve made great improvements to the converter,
139+
which is under development in the [scalameta/paradise](https://github.com/scalameta/paradise) repository.
140+
We have established a comprehensive test suite that consists of a sample of
141+
over 26.000 Scala source files collected from popular open-source
142+
projects. Thanks to the joint effort of the team of scala.meta
143+
[contributors](https://github.com/scalameta/paradise/graphs/contributors),
144+
the converter now supports about 19.000 source files form the test
145+
corpus. We are continuously working to increase that number, aiming to
146+
bring language coverage to 100%.
147+
148+
### Semantic API
149+
150+
The semantic API will enable scala.meta programs to inspect compiler information
151+
such as type inference, name resolution and other functionality that
152+
requires a compilation step. This opens opportunities for new scalafix rewrite
153+
rules that cannot be done on a purely syntactic level,
154+
like `NonVolatileLazyVal` and `ProcedureSyntax`.
155+
156+
We already have a
157+
[working prototype](https://github.com/scalacenter/scalafix/pull/14)
158+
of the first scalafix rewrite that uses the semantic API: `ExplicitImplicit`.
159+
`ExplicitImplicit` inserts type annotations for implicit definitions, like this:
160+
161+
~~~scala
162+
// before
163+
implicit val x = (_: String).length
164+
// after
165+
implicit val x: String => Int = (_: String).length
166+
~~~
167+
`ExplicitImplicit` requires the semantic API in order to get the inferred type
168+
annotations.
169+
170+
Towards new-style macros
171+
----------------------------
172+
173+
One could say that by contributing to scala.meta, we get two features
174+
for the price of one. First, an improved converter and semantic API
175+
enables us to implement more sophisticated scalafix rewrite rules.
176+
Secondly, we accelerate the development of a new macro system that will
177+
work both with scalac and Dotty.
178+
179+
As announced at Scala Days 2016, the current macros based on
180+
scala.reflect will be going away. Such macros have a number of known
181+
issues, including over complicated API and lacking IDE support. More
182+
importantly, the deep coupling between old-style macros and scalac
183+
means macros written in the old system effectively cannot be
184+
ported to Dotty. The plan is to discontinue support for scala.reflect
185+
macros in favor of [a new macro system called
186+
inline/meta](https://github.com/scala/scala.github.com/pull/567).
187+
188+
A technology preview of the new-style macros came out this summer. This
189+
early release is still somewhat rough around the edges. Nevertheless,
190+
[scalafmt](https://olafurpg.github.io/scalafmt/) is already using
191+
these new macro annotations in production for more than a month now. If you
192+
are interested in learning more, the best place to get started is
193+
[my recent Scala World workshop](http://olafurpg.github.io/scala.meta-workshop).
194+
195+
Much like scalafix, new-style macros crucially rely on the
196+
infrastructure provided by scala.meta. Concretely, the converter and the
197+
semantic APIs constitute a significant chunk of the implementation
198+
effort behind the new macro system.
199+
200+
Interestingly, our contributions to scala.meta were originally motivated
201+
by the needs of scalafix. However, they are also immediately helping the
202+
development of this new universal macro system for Scala. We are excited
203+
that our open-source collaboration with the scala.meta team brings
204+
multiple benefits for the good of everyone!
205+
206+
Get involved
207+
----------------
208+
209+
Are you interested in metaprogramming, developer tools and running
210+
experiments on millions of lines of Scala code? Come chat with us on
211+
[Gitter][gitter], and we’ll discuss how you can make a difference in shaping the
212+
developer tools of the future!
213+
214+
[gitter]: https://gitter.im/scalacenter/scalafix
215+

community/index.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,3 +113,9 @@ Staying current:
113113

114114
* [implicit.ly](http://implicit.ly) announces new versions of Scala libraries as they become available
115115
* [Scala-Announce](http://groups.google.com/group/scala-announce) also has release announcements
116+
117+
## Non-JVM platforms
118+
119+
* [Scala.js](https://www.scala-js.org) compiles Scala code to JavaScript
120+
* [Scala Native](http://www.scala-native.org) compiles Scala code to LLVM for native execution
121+
* [Scala on Android](http://scala-android.org) community site

0 commit comments

Comments
 (0)