Skip to content

Commit b67c1bc

Browse files
committedAug 10, 2017
Merge branch 'master' of github.com:scala/scala.github.com
2 parents 706503b + ff48f07 commit b67c1bc

30 files changed

+242
-279
lines changed
 

‎_includes/sidebar-toc-glossary.html‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ <h5 class="contents">Terms</h5>
55
<div id="toc"></div>
66
</div>
77
<hr>
8-
<div class="help-us"><a href="https://github.com/scala/docs.scala-lang/blob/master/{{ page.relative_path }}"><i class="fa fa-pencil" aria-hidden="true"></i> Problem with this page?<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Please help us fix it!</a></div>
8+
<div class="help-us"><a href="https://github.com/scala/docs.scala-lang/blob/master/{% if page.collection %}{{ page.relative_path }}{% else %}{{ page.path }}{% endif %}"><i class="fa fa-pencil" aria-hidden="true"></i> Problem with this page?<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Please help us fix it!</a></div>
99
</div>
1010
</div>

‎_includes/sidebar-toc-multipage-overview.html‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,6 @@ <h5 class="contents">Contents</h5>
4646
{% endif %}
4747
</div>
4848
<hr>
49-
<div class="help-us"><a href="https://github.com/scala/docs.scala-lang/blob/master/{{ page.relative_path }}"><i class="fa fa-pencil" aria-hidden="true"></i> Problem with this page?<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Please help us fix it!</a></div>
49+
<div class="help-us"><a href="https://github.com/scala/docs.scala-lang/blob/master/{% if page.collection %}{{ page.relative_path }}{% else %}{{ page.path }}{% endif %}"><i class="fa fa-pencil" aria-hidden="true"></i> Problem with this page?<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Please help us fix it!</a></div>
5050
</div>
5151
</div>

‎_includes/sidebar-toc-singlepage-overview.html‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ <h5 class="contents">Contents</h5>
2626
{% endif %}
2727
</div>
2828
<hr>
29-
<div class="help-us"><a href="https://github.com/scala/docs.scala-lang/blob/master/{{ page.relative_path }}"><i class="fa fa-pencil" aria-hidden="true"></i> Problem with this page?<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Please help us fix it!</a></div>
29+
<div class="help-us"><a href="https://github.com/scala/docs.scala-lang/blob/master/{% if page.collection %}{{ page.relative_path }}{% else %}{{ page.path }}{% endif %}"><i class="fa fa-pencil" aria-hidden="true"></i> Problem with this page?<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Please help us fix it!</a></div>
3030
</div>
3131
</div>

‎_includes/sidebar-toc-style.html‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ <h5 class="contents">Contents</h5>
5252
{% endif %}
5353
</div>
5454
<hr>
55-
<div class="help-us"><a href="https://github.com/scala/docs.scala-lang/blob/master/{{ page.relative_path }}"><i class="fa fa-pencil" aria-hidden="true"></i> Problem with this page?<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Please help us fix it!</a></div>
55+
<div class="help-us"><a href="https://github.com/scala/docs.scala-lang/blob/master/{% if page.collection %}{{ page.relative_path }}{% else %}{{ page.path }}{% endif %}"><i class="fa fa-pencil" aria-hidden="true"></i> Problem with this page?<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Please help us fix it!</a></div>
5656
</div>
5757
</div>
5858
{% endif %}

‎_includes/sidebar-toc-tour-overview.html‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,6 @@ <h5 class="contents">Contents</h5>
4444
{% endif %}
4545
</div>
4646
<hr>
47-
<div class="help-us"><a href="https://github.com/scala/docs.scala-lang/blob/master/{{ page.relative_path }}"><i class="fa fa-pencil" aria-hidden="true"></i> Problem with this page?<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Please help us fix it!</a></div>
47+
<div class="help-us"><a href="https://github.com/scala/docs.scala-lang/blob/master/{% if page.collection %}{{ page.relative_path }}{% else %}{{ page.path }}{% endif %}"><i class="fa fa-pencil" aria-hidden="true"></i> Problem with this page?<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Please help us fix it!</a></div>
4848
</div>
4949
</div>

‎_includes/sidebar-toc.html‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ <h5 class="contents">Contents</h5>
5252
{% endif %}
5353
</div>
5454
<hr>
55-
<div class="help-us"><a href="https://github.com/scala/docs.scala-lang/blob/master/{{ page.relative_path }}"><i class="fa fa-pencil" aria-hidden="true"></i> Problem with this page?<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Please help us fix it!</a></div>
55+
<div class="help-us"><a href="https://github.com/scala/docs.scala-lang/blob/master/{% if page.collection %}{{ page.relative_path }}{% else %}{{ page.path }}{% endif %}"><i class="fa fa-pencil" aria-hidden="true"></i> Problem with this page?<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Please help us fix it!</a></div>
5656
</div>
5757
</div>
5858
{% endif %}

‎_includes/tutorial-toc.html‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,6 @@ <h5>Contents</h5>
2424
{% include tutorial-tour-list.txt %}
2525
</div>
2626
<hr>
27-
<div class="help-us"><a href="https://github.com/scala/docs.scala-lang/blob/master/{{ page.relative_path }}"><i class="fa fa-pencil" aria-hidden="true"></i> Problem with this page?<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Please help us fix it!</a></div>
27+
<div class="help-us"><a href="https://github.com/scala/docs.scala-lang/blob/master/{% if page.collection %}{{ page.relative_path }}{% else %}{{ page.path }}{% endif %}"><i class="fa fa-pencil" aria-hidden="true"></i> Problem with this page?<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Please help us fix it!</a></div>
2828
</div>
2929
</div>

‎_layouts/sip.html‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ <h5 class="contents">SIP Contents</h5>
2626
<div id="toc"></div>
2727
</div>
2828
<hr>
29-
<div class="help-us"><a href="https://github.com/scala/docs.scala-lang/blob/master/{{ page.relative_path }}"><i class="fa fa-pencil" aria-hidden="true"></i> Problem with this page?<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Please help us fix it!</a></div>
29+
<div class="help-us"><a href="https://github.com/scala/docs.scala-lang/blob/master/{% if page.collection %}{{ page.relative_path }}{% else %}{{ page.path }}{% endif %}"><i class="fa fa-pencil" aria-hidden="true"></i> Problem with this page?<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Please help us fix it!</a></div>
3030
</div>
3131
</div>
3232

‎_layouts/sips.html‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ <h5 class="contents" style="margin-bottom: 0;">Writing a SIP</h5>
4040
<li><a href="{{ site.baseurl }}/sips/sip-submission.html">Submitting a SIP</a></li>
4141
<li><a href="{{ site.baseurl }}/sips/sip-tutorial.html">Tutorial: Writing a SIP</a></li>
4242
</ul>
43-
<div class="help-us"><a href="https://github.com/scala/docs.scala-lang/blob/master/{{ page.relative_path }}"><i class="fa fa-pencil" aria-hidden="true"></i> Problem with this page?<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Please help us fix it!</a></div>
43+
<div class="help-us"><a href="https://github.com/scala/docs.scala-lang/blob/master/{% if page.collection %}{{ page.relative_path }}{% else %}{{ page.path }}{% endif %}"><i class="fa fa-pencil" aria-hidden="true"></i> Problem with this page?<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Please help us fix it!</a></div>
4444
</div>
4545
</div>
4646

‎_overviews/FAQ/finding-symbols.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ supertypes (`AnyRef` or `Any`) or a type parameter. In this case, we find
163163
avaialable on all types.
164164

165165
Other implicit conversions may be visible in your scope depending on imports, extended types or
166-
self-type annotations. See [Finding implicits](tutorials/FAQ/finding-implicits.html) for details.
166+
self-type annotations. See [Finding implicits](finding-implicits.html) for details.
167167

168168
Syntactic sugars/composition
169169
-----------------------------

‎_overviews/collections/seqs.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ If a sequence is mutable, it offers in addition a side-effecting `update` method
7474
| `xs union ys` |Multiset union; same as `xs ++ ys`.|
7575
| `xs.distinct` |A subsequence of `xs` that contains no duplicated element.|
7676

77-
Trait [Seq](http://www.scala-lang.org/api/current/scala/collection/Seq.html) has two subtraits [LinearSeq](http://www.scala-lang.org/api/current/scala/collection/IndexedSeq.html), and [IndexedSeq](http://www.scala-lang.org/api/current/scala/collection/IndexedSeq.html). These do not add any new operations, but each offers different performance characteristics: A linear sequence has efficient `head` and `tail` operations, whereas an indexed sequence has efficient `apply`, `length`, and (if mutable) `update` operations. Frequently used linear sequences are `scala.collection.immutable.List` and `scala.collection.immutable.Stream`. Frequently used indexed sequences are `scala.Array` and `scala.collection.mutable.ArrayBuffer`. The `Vector` class provides an interesting compromise between indexed and linear access. It has both effectively constant time indexing overhead and constant time linear access overhead. Because of this, vectors are a good foundation for mixed access patterns where both indexed and linear accesses are used. You'll learn more on vectors [later](http://docs.scala-lang.org/overviews/collections/concrete-immutable-collection-classes.html#vectors).
77+
Trait [Seq](http://www.scala-lang.org/api/current/scala/collection/Seq.html) has two subtraits [LinearSeq](http://www.scala-lang.org/api/current/scala/collection/IndexedSeq.html), and [IndexedSeq](http://www.scala-lang.org/api/current/scala/collection/IndexedSeq.html). These do not add any new operations, but each offers different performance characteristics: A linear sequence has efficient `head` and `tail` operations, whereas an indexed sequence has efficient `apply`, `length`, and (if mutable) `update` operations. Frequently used linear sequences are `scala.collection.immutable.List` and `scala.collection.immutable.Stream`. Frequently used indexed sequences are `scala.Array` and `scala.collection.mutable.ArrayBuffer`. The `Vector` class provides an interesting compromise between indexed and linear access. It has both effectively constant time indexing overhead and constant time linear access overhead. Because of this, vectors are a good foundation for mixed access patterns where both indexed and linear accesses are used. You'll learn more on vectors [later](concrete-immutable-collection-classes.html#vectors).
7878

7979
### Buffers ###
8080

‎_overviews/collections/sets.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ Comparing the two interactions shows an important principle. You often can repla
107107

108108
Mutable sets also provide add and remove as variants of `+=` and `-=`. The difference is that `add` and `remove` return a Boolean result indicating whether the operation had an effect on the set.
109109

110-
The current default implementation of a mutable set uses a hashtable to store the set's elements. The default implementation of an immutable set uses a representation that adapts to the number of elements of the set. An empty set is represented by just a singleton object. Sets of sizes up to four are represented by a single object that stores all elements as fields. Beyond that size, immutable sets are implemented as [hash tries](concrete-immutable-collection-classes.html#hash_tries).
110+
The current default implementation of a mutable set uses a hashtable to store the set's elements. The default implementation of an immutable set uses a representation that adapts to the number of elements of the set. An empty set is represented by just a singleton object. Sets of sizes up to four are represented by a single object that stores all elements as fields. Beyond that size, immutable sets are implemented as [hash tries](concrete-immutable-collection-classes.html#hash-tries).
111111

112112
A consequence of these representation choices is that, for sets of small sizes (say up to 4), immutable sets are usually more compact and also more efficient than mutable sets. So, if you expect the size of a set to be small, try making it immutable.
113113

‎_overviews/core/actors-migration-guide.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ permalink: /overviews/core/:title.html
1414
## Introduction
1515

1616
Starting with Scala 2.11.0, the Scala
17-
[Actors](http://docs.scala-lang.org/overviews/core/actors.html)
17+
[Actors](actors.html)
1818
library is deprecated. Already in Scala 2.10.0 the default actor library is
1919
[Akka](http://akka.io).
2020

‎_overviews/core/futures.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ Fortunately the concurrent package provides a convenient way for doing so:
132132
}
133133
}
134134

135-
Note that `blocking` is a general construct that will be discussed more in depth [below](#in_a_future).
135+
Note that `blocking` is a general construct that will be discussed more in depth [below](#blocking-inside-a-future).
136136

137137
Last but not least, you must remember that the `ForkJoinPool` is not designed for long lasting blocking operations.
138138
Even when notified with `blocking` the pool might not spawn new workers as you would expect,

‎_overviews/macros/blackbox-whitebox.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ compehensibility.
3535

3636
However sometimes def macros transcend the notion of "just a regular method". For example, it is possible for a macro expansion to yield an expression of a type that is more specific than the return type of a macro. In Scala 2.10, such expansion will retain its precise type as highlighted in the ["Static return type of Scala macros"](http://stackoverflow.com/questions/13669974/static-return-type-of-scala-macros) article at Stack Overflow.
3737

38-
This curious feature provides additional flexibility, enabling [fake type providers](http://meta.plasm.us/posts/2013/07/11/fake-type-providers-part-2/), [extended vanilla materialization](/sips/pending/source-locations.html), [fundep materialization](/overviews/macros/implicits.html#fundep_materialization) and [extractor macros](https://github.com/scala/scala/commit/84a335916556cb0fe939d1c51f27d80d9cf980dc), but it also sacrifices clarity - both for humans and for machines.
38+
This curious feature provides additional flexibility, enabling [fake type providers](http://meta.plasm.us/posts/2013/07/11/fake-type-providers-part-2/), [extended vanilla materialization](/sips/pending/source-locations.html), [fundep materialization](/overviews/macros/implicits.html#fundep-materialization) and [extractor macros](https://github.com/scala/scala/commit/84a335916556cb0fe939d1c51f27d80d9cf980dc), but it also sacrifices clarity - both for humans and for machines.
3939

4040
To concretize the crucial distinction between macros that behave just like normal methods and macros that refine their return types, we introduce the notions of blackbox macros and whitebox macros. Macros that faithfully follow their type signatures are called **blackbox macros** as their implementations are irrelevant to understanding their behaviour (could be treated as black boxes). Macros that can't have precise signatures in Scala's type system are called **whitebox macros** (whitebox def macros do have signatures, but these signatures are only approximations).
4141

@@ -50,7 +50,7 @@ We express the distinction by replacing `scala.reflect.macros.Context` with `sca
5050
Blackbox def macros are treated differently from def macros of Scala 2.10. The following restrictions are applied to them by the Scala typechecker:
5151

5252
1. When an application of a blackbox macro expands into tree `x`, the expansion is wrapped into a type ascription `(x: T)`, where `T` is the declared return type of the blackbox macro with type arguments and path dependencies applied in consistency with the particular macro application being expanded. This invalidates blackbox macros as an implementation vehicle of [type providers](http://meta.plasm.us/posts/2013/07/11/fake-type-providers-part-2/).
53-
1. When an application of a blackbox macro still has undetermined type parameters after Scala's type inference algorithm has finished working, these type parameters are inferred forcedly, in exactly the same manner as type inference happens for normal methods. This makes it impossible for blackbox macros to influence type inference, prohibiting [fundep materialization](/overviews/macros/implicits.html#fundep_materialization).
53+
1. When an application of a blackbox macro still has undetermined type parameters after Scala's type inference algorithm has finished working, these type parameters are inferred forcedly, in exactly the same manner as type inference happens for normal methods. This makes it impossible for blackbox macros to influence type inference, prohibiting [fundep materialization](/overviews/macros/implicits.html#fundep-materialization).
5454
1. When an application of a blackbox macro is used as an implicit candidate, no expansion is performed until the macro is selected as the result of the implicit search. This makes it impossible to [dynamically calculate availability of implicit macros](/sips/rejected/source-locations.html).
5555
1. When an application of a blackbox macro is used as an extractor in a pattern match, it triggers an unconditional compiler error, preventing [customizations of pattern matching](https://github.com/paulp/scala/commit/84a335916556cb0fe939d1c51f27d80d9cf980dc) implemented with macros.
5656

‎_overviews/macros/bundles.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ following reasons:
2727
1. Being limited to functions makes modularizing complex macros awkward. It's quite typical to see macro logic concentrate in helper
2828
traits outside macro implementations, turning implementations into trivial wrappers, which just instantiate and call helpers.
2929

30-
2. Moreover, since macro parameters are path-dependent on the macro context, [special incantations](/overviews/macros/overview.html#writing_bigger_macros) are required to wire implementations and helpers together.
30+
2. Moreover, since macro parameters are path-dependent on the macro context, [special incantations](/overviews/macros/overview.html#writing-bigger-macros) are required to wire implementations and helpers together.
3131

3232
Macro bundles provide a solution to these problems by allowing macro implementations to be declared in classes that take
3333
`c: scala.reflect.macros.blackbox.Context` or `c: scala.reflect.macros.whitebox.Context` as their constructor parameters, relieving macro implementations from having

‎_overviews/macros/changelog211.md‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,21 @@ Quasiquotes is the single most impressive upgrade for reflection and macros in S
2525

2626
### New macro powers
2727

28-
1) **[Fundep materialization](http://docs.scala-lang.org/overviews/macros/implicits.html#fundep_materialization)**. Since Scala 2.10.2, implicit whitebox macros can be used to materialize instances of type classes, however such materialized instances can't guide type inference. In Scala 2.11.0, materializers can also affect type inference, helping scalac to infer type arguments for enclosing method applications, something that's used with great success in Shapeless. Even more, with the fix of [SI-3346](https://issues.scala-lang.org/browse/SI-3346), this inference guiding capability can affect both normal methods and implicit conversions alike. Please note, however, that fundep materialization doesn't let one change how Scala's type inference works, but merely provides a way to throw more type constraints into the mix, so it's, for example, impossible to make type inference flow from right to left using fundep materializers.
28+
1) **[Fundep materialization](implicits.html#fundep-materialization)**. Since Scala 2.10.2, implicit whitebox macros can be used to materialize instances of type classes, however such materialized instances can't guide type inference. In Scala 2.11.0, materializers can also affect type inference, helping scalac to infer type arguments for enclosing method applications, something that's used with great success in Shapeless. Even more, with the fix of [SI-3346](https://issues.scala-lang.org/browse/SI-3346), this inference guiding capability can affect both normal methods and implicit conversions alike. Please note, however, that fundep materialization doesn't let one change how Scala's type inference works, but merely provides a way to throw more type constraints into the mix, so it's, for example, impossible to make type inference flow from right to left using fundep materializers.
2929

3030
2) **[Extractor macros](https://github.com/paulp/scala/commit/84a335916556cb0fe939d1c51f27d80d9cf980dc)**. A prominent new feature in Scala 2.11.0 is [name-based extractors](https://github.com/scala/scala/pull/2848) implemented by Paul Phillips. And as usual, when there's a Scala feature, it's very likely that macros can make use of it. Indeed, with the help of structural types, whitebox macros can be used to write extractors than refine the types of extractees on case-by-case basis. This is the technique that we use internally to implement quasiquotes.
3131

3232
3) **[Named and default arguments in macros](https://github.com/scala/scala/pull/3543)**. This is something that strictly speaking shouldn't belong to this changelog, because this feature was reverted shortly after being merged into Scala 2.11.0-RC1 due to a tiny mistake that led to a regression, but we've got a patch that makes the macro engine understand named/default arguments in macro applications. Even though the code freeze won't let us bring this change in Scala 2.11.0, we expect to merge it in Scala 2.11.1 at an earliest opportunity.
3333

34-
4) **[Type macros](http://docs.scala-lang.org/overviews/macros/typemacros.html) and [macro annotations](http://docs.scala-lang.org/overviews/macros/annotations.html)**. Neither type macros, not macro annotations are included of Scala 2.11.0. It is highly unlikely that type macros will ever be included in Scala, but we still deliberate on macro annotations. However, macro annotations are available both for Scala 2.10.x and for Scala 2.11.0 via the [macro paradise plugin](http://docs.scala-lang.org/overviews/macros/annotations.html).
34+
4) **[Type macros](typemacros.html) and [macro annotations](annotations.html)**. Neither type macros, not macro annotations are included of Scala 2.11.0. It is highly unlikely that type macros will ever be included in Scala, but we still deliberate on macro annotations. However, macro annotations are available both for Scala 2.10.x and for Scala 2.11.0 via the [macro paradise plugin](annotations.html).
3535

3636
5) **@compileTimeOnly**. Standard library now features a new `scala.annotations.compileTimeOnly` annotation that tells scalac that its annottees should not be referred to after type checking (which includes macro expansion). The main use case for this annotation is marking helper methods that are only supposed be used only together with an enclosing macro call to indicate parts of arguments of that macro call that need special treatment (e.g. `await` in scala/async or `value` in sbt's new macro-based DSL). For example, scala/async's `await` marked as `@compileTimeOnly` only makes sense inside an `async { ... }` block that compiles it away during its transformation, and using it outside of `async` is a compile-time error thanks to the new annotation.
3737

3838
### Changes to the macro engine
3939

40-
6) **[Blackbox/whitebox separation](http://docs.scala-lang.org/overviews/macros/blackbox-whitebox.html)**. Macros whose macro implementations use `scala.reflect.macros.blackbox.Context` (new in Scala 2.11.0) are called blackbox, have reduced power in comparison to macros in 2.10.x, better support in IDEs and better perspectives in becoming part of Scala. Macros whose macro implementations use `scala.reflect.macros.whitebox.Context` (new in Scala 2.11.0) or `scala.reflect.macros.Context` (the only context in Scala 2.10.x, deprecated in Scala 2.11.0) are called whitebox and have at least the same power as macros in 2.10.x.
40+
6) **[Blackbox/whitebox separation](blackbox-whitebox.html)**. Macros whose macro implementations use `scala.reflect.macros.blackbox.Context` (new in Scala 2.11.0) are called blackbox, have reduced power in comparison to macros in 2.10.x, better support in IDEs and better perspectives in becoming part of Scala. Macros whose macro implementations use `scala.reflect.macros.whitebox.Context` (new in Scala 2.11.0) or `scala.reflect.macros.Context` (the only context in Scala 2.10.x, deprecated in Scala 2.11.0) are called whitebox and have at least the same power as macros in 2.10.x.
4141

42-
7) **[Macro bundles](http://docs.scala-lang.org/overviews/macros/bundles.html)**. It is well-known that path-dependent nature of the current reflection API (that's there in both Scala 2.10.x and Scala 2.11.0) makes it difficult to modularize macros. There are [design patterns](http://docs.scala-lang.org/overviews/macros/overview.html#writing_bigger_macros) that help to overcome this difficulty, but that just leads to proliferation of boilerplate. One of the approaches to dealing with this problem is doing away with cakes altogether, and that's what we're pursing in Project Palladium, but that was too big of a change to pull off in Scala 2.11.0, so we've come up with a workaround that would alleviate the problem until the real solution arrives. Macro bundles are classes that have a single public field of type `Context` and any public method inside a bundle can be referred to as a macro implementation. Such macro implementations can then easily call into other methods of the same class or its superclasses without having to carry the context around, because the bundle already carries the context that everyone inside it can see and refer to. This significantly simplifies writing and maintaining complex macros.
42+
7) **[Macro bundles](bundles.html)**. It is well-known that path-dependent nature of the current reflection API (that's there in both Scala 2.10.x and Scala 2.11.0) makes it difficult to modularize macros. There are [design patterns](overview.html#writing-bigger-macros) that help to overcome this difficulty, but that just leads to proliferation of boilerplate. One of the approaches to dealing with this problem is doing away with cakes altogether, and that's what we're pursing in Project Palladium, but that was too big of a change to pull off in Scala 2.11.0, so we've come up with a workaround that would alleviate the problem until the real solution arrives. Macro bundles are classes that have a single public field of type `Context` and any public method inside a bundle can be referred to as a macro implementation. Such macro implementations can then easily call into other methods of the same class or its superclasses without having to carry the context around, because the bundle already carries the context that everyone inside it can see and refer to. This significantly simplifies writing and maintaining complex macros.
4343

4444
8) **Relaxed requirements for signatures of macro implementations**. With the advent of quasiquotes, reify is quickly growing out of favor as being too clunky and inflexible. To recognize that we now allow both arguments and return types of macro implementations to be of type `c.Tree` rather than `c.Expr[Something]`. There's no longer a need to write huge type signatures and then spend time and lines of code trying to align your macro implementations with those types. Just take trees in and return trees back - the boilerplate is gone.
4545

@@ -120,11 +120,11 @@ Quasiquotes is the single most impressive upgrade for reflection and macros in S
120120

121121
### How to make your 2.11.0 macros work in 2.10.x
122122

123-
34) **Quasiquotes**. We don't plan to release quasiquotes as part of the Scala 2.10.x distribution, but they can still be used in Scala 2.10.x by the virtue of the macro paradise plugin. Read [paradise documentation](http://docs.scala-lang.org/overviews/macros/paradise.html) to learn more about what's required to use the compiler plugin, what are the binary compatibility consequences and what are the support guarantees.
123+
34) **Quasiquotes**. We don't plan to release quasiquotes as part of the Scala 2.10.x distribution, but they can still be used in Scala 2.10.x by the virtue of the macro paradise plugin. Read [paradise documentation](paradise.html) to learn more about what's required to use the compiler plugin, what are the binary compatibility consequences and what are the support guarantees.
124124

125-
35) **Most of the new functionality doesn't have equivalents in 2.10.x**. We don't plan to backport any of the new functionality, e.g. fundep materialization or macro bundles, to Scala 2.10.x (except for maybe thread safety for runtime reflection). Consult [the roadmap of macro paradise for Scala 2.10.x](http://docs.scala-lang.org/overviews/macros/roadmap.html) to see what features are supported in paradise.
125+
35) **Most of the new functionality doesn't have equivalents in 2.10.x**. We don't plan to backport any of the new functionality, e.g. fundep materialization or macro bundles, to Scala 2.10.x (except for maybe thread safety for runtime reflection). Consult [the roadmap of macro paradise for Scala 2.10.x](roadmap.html) to see what features are supported in paradise.
126126

127-
36) **Blackbox/whitebox**. If you're determined to have your macros blackbox, it's going to require additional effort to have those macros working consistently in both 2.10.x and 2.11.0, because in 2.10.x all macros are whitebox. First of all, make sure that you're not actually using any of [whitebox powers](http://docs.scala-lang.org/overviews/macros/blackbox-whitebox.html#codifying_the_distinction), otherwise you'll have to rewrite your macros first. Secondly, before returning from your macros impls, explicitly upcast the expansions to the type required by their macro defs. (Of course, none of this applies to whitebox macros. If don't mind your macros being whitebox, then you don't have to do anything to ensure cross-compatibility).
127+
36) **Blackbox/whitebox**. If you're determined to have your macros blackbox, it's going to require additional effort to have those macros working consistently in both 2.10.x and 2.11.0, because in 2.10.x all macros are whitebox. First of all, make sure that you're not actually using any of [whitebox powers](blackbox-whitebox.html#codifying-the-distinction), otherwise you'll have to rewrite your macros first. Secondly, before returning from your macros impls, explicitly upcast the expansions to the type required by their macro defs. (Of course, none of this applies to whitebox macros. If don't mind your macros being whitebox, then you don't have to do anything to ensure cross-compatibility).
128128

129129
object Macros {
130130
def impl(c: Context) = {

‎_overviews/macros/overview.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ A subset of def macros, pending a thorough specification, is tentatively schedul
2323
so naturally the contents of the document are outdated. Nevertheless, this guide is not obsolete -
2424
everything written here will still work in both Scala 2.10.x and Scala 2.11.x, so it will be helpful to read it through.
2525
After reading the guide, take a look at the docs on [quasiquotes](/overviews/quasiquotes/intro.html)
26-
and [macro bundles](/overviews/macros/bundles.html) to familiarize yourself with latest developments
26+
and [macro bundles](bundles.html) to familiarize yourself with latest developments
2727
that dramatically simplify writing macros. Then it might be a good idea to follow
2828
[our macro workshop](https://github.com/scalamacros/macrology201) for more in-depth examples.
2929

‎_overviews/macros/paradise.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ Proceed to the [the feature list](/overviews/macros/roadmap.html) document for m
4242

4343
Consult [https://github.com/scalamacros/sbt-example-paradise](https://github.com/scalamacros/sbt-example-paradise)
4444
for an end-to-end example, but in a nutshell working with macro paradise is as easy as adding the following two lines
45-
to your build (granted you’ve already [set up sbt](/overviews/macros/overview.html#using_macros_with_maven_or_sbt)
45+
to your build (granted you’ve already [set up sbt](/overviews/macros/overview.html#using-macros-with-maven-or-sbt)
4646
to use macros).
4747

4848
resolvers += Resolver.sonatypeRepo("releases")

‎_overviews/macros/roadmap.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ and become the new standard way of doing metaprogramming in Scala.
3232
| [Def macros](/overviews/macros/overview.html) | Yes | Yes <sup>1</sup> | Yes | Yes <sup>1</sup> | Yes | Yes <sup>1</sup> |
3333
| [Macro bundles](/overviews/macros/bundles.html) | No | No <sup>1</sup> | Yes | Yes <sup>1</sup> | Yes | Yes <sup>1</sup> |
3434
| [Implicit macros](/overviews/macros/implicits.html) | Yes (since 2.10.2) | Yes <sup>1</sup> | Yes | Yes <sup>1</sup> | Yes | Yes <sup>1</sup> |
35-
| [Fundep materialization](/overviews/macros/implicits.html#fundep_materialization) | Yes (since 2.10.5) <sup>3</sup> | Yes <sup>2</sup> | Yes | Yes <sup>1</sup> | Yes | Yes <sup>1</sup> |
35+
| [Fundep materialization](/overviews/macros/implicits.html#fundep-materialization) | Yes (since 2.10.5) <sup>3</sup> | Yes <sup>2</sup> | Yes | Yes <sup>1</sup> | Yes | Yes <sup>1</sup> |
3636
| [Type providers](/overviews/macros/typeproviders.html) | Partial support (see docs) | Yes <sup>2</sup> | Partial support (see docs) | Yes <sup>2</sup> | Partial support (see docs) | Yes <sup>2</sup> |
3737
| [Quasiquotes](/overviews/quasiquotes/intro.html) | No | Yes <sup>1</sup> | Yes | Yes <sup>1</sup> | Yes | Yes <sup>1</sup> |
3838
| [Type macros](/overviews/macros/typemacros.html) | No | No | No | No | No | No |

‎_overviews/parallel-collections/concrete-parallel-collections.md‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ arrays in the sense that their size is constant.
3232
res1: scala.collection.parallel.mutable.ParArray[Int] = ParArray(0, 1, 2, 3, 4, 5, 6, 7,...
3333

3434
Internally, splitting a parallel array
35-
[splitter]({{ site.baseurl }}/overviews/parallel-collections/architecture.html#core_abstractions)
35+
[splitter]({{ site.baseurl }}/overviews/parallel-collections/architecture.html#core-abstractions)
3636
amounts to creating two new splitters with their iteration indices updated.
37-
[Combiners]({{ site.baseurl }}/overviews/parallel-collections/architecture.html#core_abstractions)
37+
[Combiners]({{ site.baseurl }}/overviews/parallel-collections/architecture.html#core-abstractions)
3838
are slightly more involved.Since for most transformer methods (e.g. `flatMap`, `filter`, `takeWhile`,
3939
etc.) we don't know the number of elements (and hence, the array size) in
4040
advance, each combiner is essentially a variant of an array buffer with an
@@ -65,9 +65,9 @@ update time.
6565
res0: scala.collection.parallel.immutable.ParVector[Int] = ParVector(0, 2, 4, 6, 8, 10, 12, 14, 16, 18,...
6666

6767
Immutable vectors are represented by 32-way trees, so
68-
[splitter]({{ site.baseurl }}/overviews/parallel-collections/architecture.html#core_abstractions)s
68+
[splitter]({{ site.baseurl }}/overviews/parallel-collections/architecture.html#core-abstractions)s
6969
are split by assigning subtrees to each splitter.
70-
[Combiners]({{ site.baseurl }}/overviews/parallel-collections/architecture.html#core_abstractions)
70+
[Combiners]({{ site.baseurl }}/overviews/parallel-collections/architecture.html#core-abstractions)
7171
currently keep a vector of
7272
elements and are combined by lazily copying the elements. For this reason,
7373
transformer methods are less scalable than those of a parallel array. Once the
@@ -94,7 +94,7 @@ created in a similar way as the sequential
9494
res1: scala.collection.parallel.immutable.ParRange = ParRange(15, 13, 11, 9, 7, 5)
9595

9696
Just as sequential ranges have no builders, parallel ranges have no
97-
[combiner]({{ site.baseurl }}/overviews/parallel-collections/architecture.html#core_abstractions)s.
97+
[combiner]({{ site.baseurl }}/overviews/parallel-collections/architecture.html#core-abstractions)s.
9898
Mapping the elements of a parallel range produces a parallel vector.
9999
Sequential ranges and parallel ranges can be converted efficiently one from
100100
another using the `seq` and `par` methods.
@@ -153,7 +153,7 @@ and
153153
res0: Int = 332833500
154154

155155
Similar to parallel hash tables, parallel hash trie
156-
[combiners]({{ site.baseurl }}/overviews/parallel-collections/architecture.html#core_abstractions)
156+
[combiners]({{ site.baseurl }}/overviews/parallel-collections/architecture.html#core-abstractions)
157157
pre-sort the
158158
elements into buckets and construct the resulting hash trie in parallel by
159159
assigning different buckets to different processors, which construct the
@@ -194,7 +194,7 @@ following example which outputs square roots of number from 1 to 99:
194194
...
195195

196196

197-
[Combiners]({{ site.baseurl }}/overviews/parallel-collections/architecture.html#core_abstractions)
197+
[Combiners]({{ site.baseurl }}/overviews/parallel-collections/architecture.html#core-abstractions)
198198
are implemented as `TrieMap`s under the hood-- since this is a
199199
concurrent data structure, only one combiner is constructed for the entire
200200
transformer method invocation and shared by all the processors.

‎_overviews/parallel-collections/overview.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ only. As a general heuristic, speed-ups tend to be noticeable when the size of
8282
the collection is large, typically several thousand elements. (For more
8383
information on the relationship between the size of a parallel collection and
8484
performance, please see the
85-
[appropriate subsection]({{ site.baseurl}}/overviews/parallel-collections/performance.html#how_big_should_a_collection_be_to_go_parallel) of the [performance]({{ site.baseurl }}/overviews/parallel-collections/performance.html)
85+
[appropriate subsection]({{ site.baseurl}}/overviews/parallel-collections/performance.html#how-big-should-a-collection-be-to-go-parallel) of the [performance]({{ site.baseurl }}/overviews/parallel-collections/performance.html)
8686
section of this guide.)
8787

8888
#### map

‎_sips/sips/2017-02-07-make-types-behave-like-expressions.md‎

Lines changed: 133 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
layout: sip
33
discourse: true
4-
title: SIP-NN - Match infix & prefix types to meet expression rules
4+
title: SIP-33 - Match infix & prefix types to meet expression rules
55

66
vote-status: pending
77
permalink: /sips/:title.html
@@ -11,11 +11,13 @@ permalink: /sips/:title.html
1111

1212
## History
1313

14-
| Date | Version |
15-
|---------------|--------------------------|
16-
| Feb 7th 2017 | Initial Draft |
17-
| Feb 9th 2017 | Updates from feedback |
18-
| Feb 10th 2017 | Updates from feedback |
14+
| Date | Version |
15+
|---------------|------------------------------------------------------------------------|
16+
| Feb 7th 2017 | Initial Draft |
17+
| Feb 9th 2017 | Updates from feedback |
18+
| Feb 10th 2017 | Updates from feedback |
19+
| Aug 8th 2017 | Numbered SIP, improve view, fixed example, and added related issues |
20+
1921

2022
Your feedback is welcome! If you're interested in discussing this proposal, head over to [this](https://contributors.scala-lang.org/t/sip-nn-make-infix-type-alias-precedence-like-expression-operator-precedence/471) Scala Contributors thread and let me know what you think.
2123

@@ -30,70 +32,70 @@ Infix types are 'mostly' left-associative,
3032
while the expression operation precedence is determined by the operator's first character (e.g., `/` is precedent to `+`).
3133
Please see [Infix Types](http://scala-lang.org/files/archive/spec/2.12/03-types.html#infix-types) and [Infix Operations](http://scala-lang.org/files/archive/spec/2.12/06-expressions.html#infix-operations) sections of the Scala specifications for more details.
3234

33-
**Example**:
34-
35-
{% highlight scala %}
36-
object InfixExpressionPrecedence {
37-
case class Nummy(expand : String) {
38-
def + (that : Nummy) : Nummy = Nummy(s"Plus[$this,$that]")
39-
def / (that : Nummy) : Nummy = Nummy(s"Div[$this,$that]")
40-
}
41-
object N1 extends Nummy("N1")
42-
object N2 extends Nummy("N2")
43-
object N3 extends Nummy("N3")
44-
object N4 extends Nummy("N4")
45-
//Both expand to Plus[Plus[N1,Div[N2,N3]],N4]
46-
assert((N1 + N2 / N3 + N4).expand == (N1 + (N2 / N3) + N4).expand)
47-
}
48-
object InfixTypePrecedence {
49-
trait Plus[N1, N2]
50-
trait Div[N1, N2]
51-
type +[N1, N2] = Plus[N1, N2]
52-
type /[N1, N2] = Div[N1, N2]
53-
trait N1
54-
trait N2
55-
trait N3
56-
trait N4
57-
//Error!
58-
//Left expands to Plus[Plus[N1,Div[N2,N3]],N4] (Surprising)
59-
//Right expands to Plus[Div[Plus[N1,N2],N3],N4]
60-
implicitly[(N1 + N2 / N3 + N4) =:= (N1 + (N2 / N3) + N4)]
61-
}
62-
{% endhighlight %}
35+
**Infix expression precedence vs. infix type precedence example**:
36+
37+
```scala
38+
object InfixExpressionPrecedence {
39+
case class Nummy(expand : String) {
40+
def + (that : Nummy) : Nummy = Nummy(s"Plus[$this,$that]")
41+
def / (that : Nummy) : Nummy = Nummy(s"Div[$this,$that]")
42+
}
43+
object N1 extends Nummy("N1")
44+
object N2 extends Nummy("N2")
45+
object N3 extends Nummy("N3")
46+
object N4 extends Nummy("N4")
47+
//Both expand to Plus[Plus[N1,Div[N2,N3]],N4]
48+
assert((N1 + N2 / N3 + N4).expand == (N1 + (N2 / N3) + N4).expand)
49+
}
50+
object InfixTypePrecedence {
51+
trait Plus[N1, N2]
52+
trait Div[N1, N2]
53+
type +[N1, N2] = Plus[N1, N2]
54+
type /[N1, N2] = Div[N1, N2]
55+
trait N1
56+
trait N2
57+
trait N3
58+
trait N4
59+
//Error!
60+
//Left expands to Plus[Div[Plus[N1,N2],N3],N4] (Surprising)
61+
//Right expands to Plus[Plus[N1,Div[N2,N3]],N4]
62+
implicitly[(N1 + N2 / N3 + N4) =:= (N1 + (N2 / N3) + N4)]
63+
}
64+
```
6365

6466
### Prefix operators bracketless unary use
6567
While expressions have prefix unary operators, there are none for types. See the [Prefix Operations](http://scala-lang.org/files/archive/spec/2.12/06-expressions.html#prefix-operations) section of the Scala specification.
6668
This is a lacking feature of the type language Scala offers. See also interactions of this feature with other Scala features, further down this text.
6769

6870

69-
**Example**:
70-
71-
{% highlight scala %}
72-
object PrefixExpression {
73-
case class Nummy(expand : String) {
74-
def unary_- : Nummy = Nummy(s"-$this")
75-
def unary_~ : Nummy = Nummy(s"~$this")
76-
def unary_! : Nummy = Nummy(s"!$this")
77-
def unary_+ : Nummy = Nummy(s"+$this")
78-
}
79-
object N extends Nummy("N")
80-
val n1 = -N
81-
val n2 = ~N
82-
val n3 = !N
83-
val n4 = +N
84-
}
85-
object NonExistingPrefixTypes {
86-
trait unary_-[A]
87-
trait unary_~[A]
88-
trait unary_![A]
89-
trait unary_+[A]
90-
trait N
91-
type N1 = -N //Not working
92-
type N2 = ~N //Not working
93-
type N3 = !N //Not working
94-
type N4 = +N //Not working
95-
}
96-
{% endhighlight %}
71+
**Prefix expression vs. prefix type example**:
72+
73+
```scala
74+
object PrefixExpression {
75+
case class Nummy(expand : String) {
76+
def unary_- : Nummy = Nummy(s"-$this")
77+
def unary_~ : Nummy = Nummy(s"~$this")
78+
def unary_! : Nummy = Nummy(s"!$this")
79+
def unary_+ : Nummy = Nummy(s"+$this")
80+
}
81+
object N extends Nummy("N")
82+
val n1 = -N
83+
val n2 = ~N
84+
val n3 = !N
85+
val n4 = +N
86+
}
87+
object NonExistingPrefixTypes {
88+
trait unary_-[A]
89+
trait unary_~[A]
90+
trait unary_![A]
91+
trait unary_+[A]
92+
trait N
93+
type N1 = -N //Not working
94+
type N2 = ~N //Not working
95+
type N3 = !N //Not working
96+
type N4 = +N //Not working
97+
}
98+
```
9799

98100
---
99101

@@ -124,30 +126,30 @@ Dotty has no prefix types, same as Scalac.
124126
The [singleton-ops library](https://github.com/fthomas/singleton-ops) with [Typelevel Scala](https://github.com/typelevel/scala) (which implemented [SIP-23](http://docs.scala-lang.org/sips/pending/42.type.html)) enables developers to express literal type operations more intuitively.
125127
For example:
126128

127-
{% highlight scala %}
128-
import singleton.ops._
129+
```scala
130+
import singleton.ops._
129131

130-
val four1 : 4 = implicitly[2 + 2]
131-
val four2 : 2 + 2 = 4
132-
val four3 : 1 + 3 = implicitly[2 + 2]
132+
val four1 : 4 = implicitly[2 + 2]
133+
val four2 : 2 + 2 = 4
134+
val four3 : 1 + 3 = implicitly[2 + 2]
133135

134-
class MyVec[L] {
135-
def doubleSize = new MyVec[2 * L]
136-
def nSize[N] = new MyVec[N * L]
137-
}
138-
object MyVec {
139-
implicit def apply[L](implicit check : Require[L > 0]) : MyVec[L] = new MyVec[L]()
140-
}
141-
val myVec : MyVec[10] = MyVec[4 + 1].doubleSize
142-
val myBadVec = MyVec[-1] //fails compilation, as required
143-
{% endhighlight %}
136+
class MyVec[L] {
137+
def doubleSize = new MyVec[2 * L]
138+
def nSize[N] = new MyVec[N * L]
139+
}
140+
object MyVec {
141+
implicit def apply[L](implicit check : Require[L > 0]) : MyVec[L] = new MyVec[L]()
142+
}
143+
val myVec : MyVec[10] = MyVec[4 + 1].doubleSize
144+
val myBadVec = MyVec[-1] //fails compilation, as required
145+
```
144146

145147
We currently loose some of the intuitive appeal due to the precedence issue:
146148

147-
{% highlight scala %}
148-
val works : 1 + (2 * 3) + 4 = 11
149-
val fails : 1 + 2 * 3 + 4 = 11 //left associative:(((1+2)*3)+4))) = 13
150-
{% endhighlight %}
149+
```scala
150+
val works : 1 + (2 * 3) + 4 = 11
151+
val fails : 1 + 2 * 3 + 4 = 11 //left associative:(((1+2)*3)+4))) = 13
152+
```
151153

152154
#### Developer issues example
153155
[This](http://stackoverflow.com/questions/23333882/scala-infix-type-aliasing-for-2-type-parameters) stackoverflow question demonstrate developers are 'surprised' by the difference in infix precedence, expecting infix type precedence to act the same as expression operations.
@@ -160,40 +162,67 @@ We currently loose some of the intuitive appeal due to the precedence issue:
160162
Variance annotation uses the `-` and `+` symbols to annotate contravariant and covariant subtyping, respectively. Introducing unary prefix types may lead to some developer confusion.
161163
E.g.
162164

163-
{% highlight scala %}
164-
trait Negate[A]
165-
trait Positive[A]
166-
type unary_-[A] = Negate[A]
167-
type unary_+[A] = Positive[A]
168-
trait Contravariant[B, -A <: -B] //contravariant A subtype upper-bounded by Negate[B]
169-
trait Covariant[B, +A <: +B] //covariant A subtype upper-bounded by Positive[B]
170-
{% endhighlight %}
165+
```scala
166+
trait Negate[A]
167+
trait Positive[A]
168+
type unary_-[A] = Negate[A]
169+
type unary_+[A] = Positive[A]
170+
trait Contravariant[B, -A <: -B] //contravariant A subtype upper-bounded by Negate[B]
171+
trait Covariant[B, +A <: +B] //covariant A subtype upper-bounded by Positive[B]
172+
```
171173

172174
#### Negative Literal Types
173175
Negative literal types are annotated using the `-` symbol. This can lead to the following confusion:
174176

175-
{% highlight scala %}
176-
trait Negate[A]
177-
type unary_-[A] = Negate[A]
178-
trait MyTrait[B]
177+
```scala
178+
trait Negate[A]
179+
type unary_-[A] = Negate[A]
180+
trait MyTrait[B]
179181

180-
type MinusFortyTwo = MyTrait[-42]
181-
type NegateFortyTwo = MyTrait[Negate[42]]
182-
{% endhighlight %}
182+
type MinusFortyTwo = MyTrait[-42]
183+
type NegateFortyTwo = MyTrait[Negate[42]]
184+
```
183185

184186
The above example demonstrates a case of two types `MinusFortyTwo` and `NegateFortyTwo` which are different. They may be equivalent in view (implicit conversion between the two type instances), but they are not equal.
185187

186188
Note: It is not possible to annotate a positive literal type in Scala (checked both in TLS and Dotty):
187189

188-
{% highlight scala %}
189-
val a : 42 = +42 //works
190-
val b : -42 = -42 //works
191-
val c : +42 = 42 //error: ';' expected but integer literal found
192-
{% endhighlight %}
190+
```scala
191+
val a : 42 = +42 //works
192+
val b : -42 = -42 //works
193+
val c : +42 = 42 //error: ';' expected but integer literal found
194+
```
193195

194196
This means that if unary prefix types are added, then `+42` will be a type expansion of `unary_+[42]`.
195197

196-
---
198+
**Related Issues**
199+
* [Dotty Issue #2783](https://github.com/lampepfl/dotty/issues/2783)
200+
* [Typelevel Scala Issue #157](https://github.com/typelevel/scala/issues/157)
201+
202+
Both SIP23 implementation and Dotty's implementation of literal types currently fail compilation when infix types interact with a negative literal type.
203+
```scala
204+
type ~~[A, B]
205+
type good = 2 ~~ 2
206+
type bad = 2 ~~ -2 //Error:(9, 20) ';' expected but integer literal found.
207+
type work_around = 2 ~~ (-2) //works for Typelevel scala, but fails in Dotty
208+
```
209+
It is not yet clear if this is an implementation issue, or if the spec should be changed to allow this as well.
210+
If this is a spec change, then the committee should approve it also.
211+
212+
#### Star `*` infix type interaction with repeated parameters
213+
The [repeated argument symbol `*`](https://www.scala-lang.org/files/archive/spec/2.12/04-basic-declarations-and-definitions.html#repeated-parameters) may create confusion with the infix type `*`.
214+
Please note that this feature interaction already exists within the current specification.
215+
216+
```scala
217+
trait *[N1, N2]
218+
trait N1
219+
trait N2
220+
def foo(a : N1*N2*) : Unit = {} //repeated parameter of type *[N1, N2]
221+
```
222+
223+
**Related Issues**
224+
* [Dotty Issue #1961](https://github.com/lampepfl/dotty/issues/1961)
225+
197226

198227
## Backward Compatibility
199228
Changing infix type associativity and precedence affects code that uses type operations and conforms to the current specification.

‎_style/index.md‎

Lines changed: 63 additions & 127 deletions
Original file line numberDiff line numberDiff line change
@@ -6,134 +6,70 @@ overview-name: "&nbsp;"
66
---
77

88
This document is intended to outline some basic Scala stylistic guidelines which should be followed with more or less fervency. Wherever possible, this guide attempts to detail why a particular style is encouraged and how it relates to other alternatives. As with all style guides, treat this document as a list of rules to be broken. There are certainly times when alternative styles should be preferred over the ones given here.
9-
<div class="span8">
109

11-
<ul>
12-
<li><a href="{{ site.baseurl }}/style/indentation.html">Indentation</a>
13-
<ul>
14-
<li><a href="{{ site.baseurl }}/style/indentation.html#line-wrapping">Line Wrapping</a></li>
15-
<li><a href="{{ site.baseurl }}/style/indentation.html#methods-with-numerous-arguments">Methods with Numerous Arguments</a></li>
16-
</ul>
17-
</li>
18-
<li><a href="{{ site.baseurl }}/style/naming-conventions.html">Naming Conventions</a>
19-
<ul>
20-
<li><a href="{{ site.baseurl }}/style/naming-conventions.html#classestraits">Classes/Traits</a></li>
21-
<li><a href="{{ site.baseurl }}/style/naming-conventions.html#objects">Objects</a></li>
22-
<li><a href="{{ site.baseurl }}/style/naming-conventions.html#packages">Packages</a>
23-
<ul>
24-
<li><a href="{{ site.baseurl }}/style/naming-conventions.html#root">root</a></li>
25-
</ul>
26-
</li>
27-
<li><a href="{{ site.baseurl }}/style/naming-conventions.html#methods">Methods</a>
28-
<ul>
29-
<li><a href="{{ site.baseurl }}/style/naming-conventions.html#accessorsmutators">Accessors/Mutators</a></li>
30-
<li><a href="{{ site.baseurl }}/style/naming-conventions.html#parentheses">Parentheses</a></li>
31-
<li><a href="{{ site.baseurl }}/style/naming-conventions.html#symbolic-method-names">Symbolic Method Names</a></li>
32-
</ul>
33-
</li>
34-
<li><a href="{{ site.baseurl }}/style/naming-conventions.html#constants-values-variable-and-methods">Constants, Values, Variable and Methods</a></li>
35-
<li><a href="{{ site.baseurl }}/style/naming-conventions.html#type-parameters-generics">Type Parameters (generics)</a>
36-
<ul>
37-
<li><a href="{{ site.baseurl }}/style/naming-conventions.html#higher-kinds-and-parameterized-type-parameters">Higher-Kinds and Parameterized Type parameters</a></li>
38-
</ul>
39-
</li>
40-
<li><a href="{{ site.baseurl }}/style/naming-conventions.html#annotations">Annotations</a></li>
41-
<li><a href="{{ site.baseurl }}/style/naming-conventions.html#special-note-on-brevity">Special Note on Brevity</a></li>
42-
</ul>
43-
</li>
44-
<li><a href="{{ site.baseurl }}/style/types.html">Types</a>
45-
<ul>
46-
<li><a href="{{ site.baseurl }}/style/types.html#inference">Inference</a>
47-
<ul>
48-
<li><a href="{{ site.baseurl }}/style/types.html#function-values">Function Values</a></li>
49-
</ul>
50-
</li>
51-
<li><a href="{{ site.baseurl }}/style/types.html#annotations">Annotations</a></li>
52-
<li><a href="{{ site.baseurl }}/style/types.html#ascription">Ascription</a></li>
53-
<li><a href="{{ site.baseurl }}/style/types.html#functions">Functions</a>
54-
<ul>
55-
<li><a href="{{ site.baseurl }}/style/types.html#arity-1">Arity-1</a></li>
56-
</ul>
57-
</li>
58-
<li><a href="{{ site.baseurl }}/style/types.html#structural-types">Structural Types</a></li>
59-
</ul>
60-
</li>
61-
<li><a href="{{ site.baseurl }}/style/nested-blocks.html">Nested Blocks</a>
62-
<ul>
63-
<li><a href="{{ site.baseurl }}/style/nested-blocks.html#curly-braces">Curly Braces</a></li>
64-
<li><a href="{{ site.baseurl }}/style/nested-blocks.html#parentheses">Parentheses</a></li>
65-
</ul>
66-
</li>
67-
<li><a href="{{ site.baseurl }}/style/declarations.html">Declarations</a>
68-
<ul>
69-
<li><a href="{{ site.baseurl }}/style/declarations.html#classes">Classes</a>
70-
<ul>
71-
<li><a href="{{ site.baseurl }}/style/declarations.html#ordering-of-class-elements">Ordering Of Class Elements</a></li>
72-
<li><a href="{{ site.baseurl }}/style/declarations.html#methods">Methods</a>
73-
<ul>
74-
<li><a href="{{ site.baseurl }}/style/declarations.html#modifiers">Modifiers</a></li>
75-
<li><a href="{{ site.baseurl }}/style/declarations.html#body">Body</a></li>
76-
<li><a href="{{ site.baseurl }}/style/declarations.html#multiple-parameter-lists">Multiple Parameter Lists</a></li>
77-
<li><a href="{{ site.baseurl }}/style/declarations.html#higher-order-functions">Higher-Order Functions</a></li>
78-
</ul>
79-
</li>
80-
<li><a href="{{ site.baseurl }}/style/declarations.html#fields">Fields</a></li>
81-
</ul>
82-
</li>
83-
<li><a href="{{ site.baseurl }}/style/declarations.html#function_values">Function Values</a>
84-
<ul>
85-
<li><a href="{{ site.baseurl }}/style/declarations.html#spacing">Spacing</a></li>
86-
<li><a href="{{ site.baseurl }}/style/declarations.html#multi-expression-functions">Multi-Expression Functions</a></li>
87-
</ul>
88-
</li>
89-
</ul>
90-
</li>
91-
<li><a href="{{ site.baseurl }}/style/control-structures.html">Control Structures</a>
92-
<ul>
93-
<li><a href="{{ site.baseurl }}/style/control-structures.html#curly-braces">Curly-Braces</a></li>
94-
<li><a href="{{ site.baseurl }}/style/control-structures.html#comprehensions">Comprehensions</a></li>
95-
<li><a href="{{ site.baseurl }}/style/control-structures.html#trivial-conditionals">Trivial Conditionals</a></li>
96-
</ul>
97-
</li>
98-
<li><a href="{{ site.baseurl }}/style/method-invocation.html">Method Invocation</a>
99-
<ul>
100-
<li><a href="{{ site.baseurl }}/style/method-invocation.html#arity-0">Arity-0</a></li>
101-
<ul>
102-
<li><a href="{{ site.baseurl }}/style/method-invocation.html#suffix-notation">Suffix Notation</a></li>
103-
</ul>
104-
<li><a href="{{ site.baseurl }}/style/method-invocation.html#arity-1">Arity-1</a></li>
105-
<ul>
106-
<li><a href="{{ site.baseurl }}/style/method-invocation.html#higher-order-functions">Higher-Order Functions</a></li>
107-
</ul>
108-
<li><a href="{{ site.baseurl }}/style/method-invocation.html#symbolic-methodsoperators">Symbolic methods/Operators</a></li>
109-
</ul>
110-
</li>
111-
<li><a href="{{ site.baseurl }}/style/files.html">Files</a>
112-
<ul>
113-
<li><a href="{{ site.baseurl }}/style/files.html#multi-unit-files">Multi-Unit Files</a></li>
114-
</ul>
115-
</li>
116-
<li><a href="{{ site.baseurl }}/style/scaladoc.html">Scaladoc</a>
117-
<ul>
118-
<li><a href="{{ site.baseurl }}/style/scaladoc.html#general-style">General Style</a></li>
119-
<li><a href="{{ site.baseurl }}/style/scaladoc.html#packages">Packages</a></li>
120-
<li><a href="{{ site.baseurl }}/style/scaladoc.html#classes-objects-and-traits">Classes, Objects, and Traits</a>
121-
<ul>
122-
<li><a href="{{ site.baseurl }}/style/scaladoc.html#classes">Classes</a></li>
123-
<li><a href="{{ site.baseurl }}/style/scaladoc.html#objects">Objects</a></li>
124-
<li><a href="{{ site.baseurl }}/style/scaladoc.html#traits">Traits</a></li>
125-
</ul>
126-
</li>
127-
<li><a href="{{ site.baseurl }}/style/scaladoc.html#methods-and-other-members">Methods and Other Members</a></li>
128-
</ul>
129-
</li>
130-
</ul>
13110

132-
</div>
11+
- [Indentation](indentation.html)
12+
- [Line Wrapping](indentation.html#line-wrapping)
13+
- [Methods with Numerous Arguments](indentation.html#methods-with-numerous-arguments)
14+
- [Naming Conventions](naming-conventions.html)
15+
- [Classes/Traits](naming-conventions.html#classestraits)
16+
- [Objects](naming-conventions.html#objects)
17+
- [Packages](naming-conventions.html#packages)
18+
- [root](naming-conventions.html#root)
19+
- [Methods](naming-conventions.html#methods)
20+
- [Accessors/Mutators](naming-conventions.html#accessorsmutators)
21+
- [Parentheses](naming-conventions.html#parentheses)
22+
- [Symbolic Method Names](naming-conventions.html#symbolic-method-names)
23+
- [Constants, Values, Variable and Methods](naming-conventions.html#constants-values-variable-and-methods)
24+
- [Type Parameters (generics)](naming-conventions.html#type-parameters-generics)
25+
- [Higher-Kinds and Parameterized Type parameters](naming-conventions.html#higher-kinds-and-parameterized-type-parameters)
26+
- [Annotations](naming-conventions.html#annotations)
27+
- [Special Note on Brevity](naming-conventions.html#special-note-on-brevity)
28+
- [Types](types.html)
29+
- [Inference](types.html#inference)
30+
- [Function Values](types.html#function-values)
31+
- [Annotations](types.html#annotations)
32+
- [Ascription](types.html#ascription)
33+
- [Functions](types.html#functions)
34+
- [Arity-1](types.html#arity-1)
35+
- [Structural Types](types.html#structural-types)
36+
- [Nested Blocks](nested-blocks.html)
37+
- [Curly Braces](nested-blocks.html#curly-braces)
38+
- [Parentheses](nested-blocks.html#parentheses)
39+
- [Declarations](declarations.html)
40+
- [Classes](declarations.html#classes)
41+
- [Ordering Of Class Elements](declarations.html#ordering-of-class-elements)
42+
- [Methods](declarations.html#methods)
43+
- [Modifiers](declarations.html#modifiers)
44+
- [Body](declarations.html#body)
45+
- [Multiple Parameter Lists](declarations.html#multiple-parameter-lists)
46+
- [Higher-Order Functions](declarations.html#higher-order-functions)
47+
- [Fields](declarations.html#fields)
48+
- [Function Values](declarations.html#function-values)
49+
- [Spacing](declarations.html#spacing)
50+
- [Multi-Expression Functions](declarations.html#multi-expression-functions)
51+
- [Control Structures](control-structures.html)
52+
- [Curly-Braces](control-structures.html#curly-braces)
53+
- [Comprehensions](control-structures.html#comprehensions)
54+
- [Trivial Conditionals](control-structures.html#trivial-conditionals)
55+
- [Method Invocation](method-invocation.html)
56+
- [Arity-0](method-invocation.html#arity-0)
57+
- [Infix Notation](method-invocation.html#infix-notation)
58+
- [Postfix Notation](method-invocation.html#posfix-notation)
59+
- [Arity-1](method-invocation.html#arity-1)
60+
- [Higher-Order Functions](method-invocation.html#higher-order-functions)
61+
- [Symbolic methods/Operators](method-invocation.html#symbolic-methodsoperators)
62+
- [Files](files.html)
63+
- [Multi-Unit Files](files.html#multi-unit-files)
64+
- [Scaladoc](scaladoc.html)
65+
- [General Style](scaladoc.html#general-style)
66+
- [Packages](scaladoc.html#packages)
67+
- [Classes, Objects, and Traits](scaladoc.html#classes-objects-and-traits)
68+
- [Classes](scaladoc.html#classes)
69+
- [Objects](scaladoc.html#objects)
70+
- [Traits](scaladoc.html#traits)
71+
- [Methods and Other Members](scaladoc.html#methods-and-other-members)
13372

134-
<div class="span8">
73+
### Thanks to ###
13574

136-
<h3>Thanks to</h3>
137-
<p><a href="http://www.codecommit.com/">Daniel Spiewak</a> and <a href="http://www.naildrivin5.com/">David Copeland</a> for putting this style guide together, and Simon Ochsenreither for converting it to Markdown.</p>
138-
139-
</div>
75+
[Daniel Spiewak](http://www.codecommit.com/) and [David Copeland](http://www.naildrivin5.com/) for putting this style guide together, and Simon Ochsenreither for converting it to Markdown.

‎_tour/basics.md‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,6 @@ val getTheAnswer = () => 42
130130
println(getTheAnswer()) // 42
131131
```
132132

133-
We will cover functions in depth [later](anonymous-function-syntax.html).
134-
135133
## Methods
136134

137135
Methods look and behave very similar to functions, but there are a few key differences between them.

‎_tour/tour-of-scala.md‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ Scala is a modern multi-paradigm programming language designed to express common
1919
Scala is a pure object-oriented language in the sense that [every value is an object](unified-types.html). Types and behavior of objects are described by [classes](classes.html) and [traits](traits.html). Classes are extended by subclassing and a flexible [mixin-based composition](mixin-class-composition.html) mechanism as a clean replacement for multiple inheritance.
2020

2121
## Scala is functional ##
22-
Scala is also a functional language in the sense that [every function is a value](unified-types.html). Scala provides a [lightweight syntax](anonymous-function-syntax.html) for defining anonymous functions, it supports [higher-order functions](higher-order-functions.html), it allows functions to be [nested](nested-functions.html), and supports [currying](currying.html). Scala's [case classes](case-classes.html) and its built-in support for [pattern matching](pattern-matching.html) model algebraic types used in many functional programming languages. [Singleton objects](singleton-objects.html) provide a convenient way to group functions that aren't members of a class.
22+
Scala is also a functional language in the sense that [every function is a value](unified-types.html). Scala provides a [lightweight syntax](basic.html#functions) for defining anonymous functions, it supports [higher-order functions](higher-order-functions.html), it allows functions to be [nested](nested-functions.html), and supports [currying](currying.html). Scala's [case classes](case-classes.html) and its built-in support for [pattern matching](pattern-matching.html) model algebraic types used in many functional programming languages. [Singleton objects](singleton-objects.html) provide a convenient way to group functions that aren't members of a class.
2323

24-
Furthermore, Scala's notion of pattern matching naturally extends to the [processing of XML data](xml-processing.html) with the help of [right-ignoring sequence patterns](regular-expression-patterns.html), by way of general extension via [extractor objects](extractor-objects.html). In this context, [for comprehensions](for-comprehensions.html) are useful for formulating queries. These features make Scala ideal for developing applications like web services.
24+
Furthermore, Scala's notion of pattern matching naturally extends to the [processing of XML data](https://github.com/scala/scala-xml/wiki/XML-Processing) with the help of [right-ignoring sequence patterns](regular-expression-patterns.html), by way of general extension via [extractor objects](extractor-objects.html). In this context, [for comprehensions](for-comprehensions.html) are useful for formulating queries. These features make Scala ideal for developing applications like web services.
2525

2626
## Scala is statically typed ##
2727
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:
@@ -31,7 +31,7 @@ Scala is equipped with an expressive type system that enforces statically that a
3131
* [upper](upper-type-bounds.html) and [lower](lower-type-bounds.html) type bounds,
3232
* [inner classes](inner-classes.html) and [abstract types](abstract-types.html) as object members
3333
* [compound types](compound-types.html)
34-
* [explicitly typed self references](explicitly-typed-self-references.html)
34+
* [explicitly typed self references](self-types.html)
3535
* [implicit parameters](implicit-parameters.html) and [conversions](implicit-conversions.html)
3636
* [polymorphic methods](polymorphic-methods.html)
3737

@@ -43,6 +43,6 @@ In practice, the development of domain-specific applications often requires doma
4343

4444
A joint use of both features facilitates the definition of new statements without using meta-programming facilities such as macros.
4545

46-
Scala is designed to interoperate well with the popular Java 2 Runtime Environment (JRE). In particular, the interaction with the mainstream object-oriented Java programming language is as smooth as possible. Newer Java features like [annotations](annotations.html) and Java generics have direct analogues in Scala. Those Scala features without Java analogues, such as [default](default-parameter-values.html) and [named parameters](named-parameters.html), compile as close to Java as they can reasonably come. Scala has the same compilation model (separate compilation, dynamic class loading) like Java and allows access to thousands of existing high-quality libraries.
46+
Scala is designed to interoperate well with the popular Java 2 Runtime Environment (JRE). In particular, the interaction with the mainstream object-oriented Java programming language is as smooth as possible. Newer Java features like [annotations](annotations.html) and Java generics have direct analogues in Scala. Those Scala features without Java analogues, such as [default](default-parameter-values.html) and [named parameters](named-arguments.html), compile as close to Java as they can reasonably come. Scala has the same compilation model (separate compilation, dynamic class loading) like Java and allows access to thousands of existing high-quality libraries.
4747

4848
Please continue to the next page to read more.

‎_tour/unified-types.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ true
5454

5555
## Type Casting
5656
Value types can be cast in the following way:
57-
<a href="/tutorials/tour/type-casting-diagram.svg"><img style="width:100%" src="/tutorials/tour/type-casting-diagram.svg" alt="Scala Type Hierarchy"></a>
57+
<a href="{{ site.baseurl }}/resources/images/tour/type-casting-diagram.svg"><img style="width:100%" src="{{ site.baseurl }}/resources/images/tour/type-casting-diagram.svg" alt="Scala Type Hierarchy"></a>
5858

5959
For example:
6060

‎getting-started-intellij-track/building-a-scala-project-with-intellij-and-sbt.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ or more than one code file.
1515
## Creating the project
1616
In this section, we'll show you how to create the project in IntelliJ. However, if you're
1717
comfortable with the command line, we recommend you try [Getting
18-
Started with Scala and sbt on the Command Line]({{site.baseurl}}/documentation/getting-started-sbt-track/getting-started-with-scala-and-sbt-on-the-command-line.html) and then come back
18+
Started with Scala and sbt on the Command Line]({{site.baseurl}}/getting-started-sbt-track/getting-started-with-scala-and-sbt-on-the-command-line.html) and then come back
1919
here to the section "Writing Scala code".
2020

2121
1. If you didn't create the project from the command line, open up IntelliJ and select "Create New Project"
@@ -86,7 +86,7 @@ extra functionality to our apps.
8686
libraryDependencies += "org.scala-lang.modules" %% "scala-parser-combinators" % "1.0.5"
8787
```
8888
Here, `libraryDependencies` is a set of dependencies, and by using `+=`,
89-
we're adding the [scala-parser-combinators]({{site.baseurl}}/scala/scala-parser-combinators) dependency to the set of dependencies that sbt will go
89+
we're adding the [scala-parser-combinators](https://github.com/scala/scala-parser-combinators) dependency to the set of dependencies that sbt will go
9090
and fetch when it starts up. Now, in any Scala file, you can import classes,
9191
objects, etc, from scala-parser-combinators with a regular import.
9292

‎getting-started-sbt-track/getting-started-with-scala-and-sbt-on-the-command-line.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ extra functionality to our apps.
6868
libraryDependencies += "org.scala-lang.modules" %% "scala-parser-combinators" % "1.0.5"
6969
```
7070
Here, `libraryDependencies` is a set of dependencies, and by using `+=`,
71-
we're adding the [scala-parser-combinators]({{site.baseurl}}/scala/scala-parser-combinators) dependency to the set of dependencies that sbt will go
71+
we're adding the [scala-parser-combinators](https://github.com/scala/scala-parser-combinators) dependency to the set of dependencies that sbt will go
7272
and fetch when it starts up. Now, in any Scala file, you can import classes,
7373
objects, etc, from scala-parser-combinators with a regular import.
7474

‎getting-started.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ Scala project. -->
5353
## Next Steps
5454
Once you've finished these tutorials, check out
5555

56-
* [The Tour of Scala](http://docs.scala-lang.org/tutorials/tour/tour-of-scala.html) for bite-sized introductions to Scala's features.
57-
* [Learning Resources](learn), which includes online interactive tutorials and courses.
58-
* [Our list of some popular Scala books]({{ site.baseurl }}/books.html).
56+
* [The Tour of Scala](tutorials/tour/tour-of-scala.html) for bite-sized introductions to Scala's features.
57+
* [Learning Resources](learn.html), which includes online interactive tutorials and courses.
58+
* [Our list of some popular Scala books](books.html).
5959

6060
## Getting Help
6161
There are a multitude of mailing lists and real-time chat channels in case you want to quickly connect with other Scala users. Check out our [community](https://scala-lang.org/community/) page a list of these resources and where to reach out for help.

0 commit comments

Comments
 (0)
Please sign in to comment.