Skip to content

Commit c4c7c61

Browse files
authored
Merge branch 'scala:main' into patch-4
2 parents c450b9d + 6cdb7a3 commit c4c7c61

File tree

14 files changed

+63
-32
lines changed

14 files changed

+63
-32
lines changed

_includes/masthead-community.html

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ <h4><a href="{{forum.url}}">{{forum.title}}</a></h4>
1717
{% endfor %}
1818
</ul>
1919
</div>
20-
<div class="gitter">
21-
<h3>Gitter</h3>
22-
<span>Real-time (topic-specialized) chat</span>
20+
<div class="discord">
21+
<h3>Chat</h3>
22+
<span>Real-time chat on Discord</span>
2323
<ul>
24-
{% for channel in site.data.chats-forums.gitterChannels %}
24+
{% for server in site.data.chats-forums.discordServers %}
2525
<li>
26-
<a href="{{channel.url}}">
27-
<img src="{{ site.baseurl }}/resources/img/frontpage/gitter-logo.png" alt="{{channel.name}}">
28-
<h4>{{channel.name}}</h4>
26+
<a href="{{server.url}}">
27+
<img src="{{ site.baseurl }}/resources/img/frontpage/discord-logo.png" alt="{{server.name}}">
28+
<h4>{{server.name}}</h4>
2929
</a>
3030
</li>
3131
{% endfor %}
@@ -34,4 +34,4 @@ <h4>{{channel.name}}</h4>
3434
</div>
3535
</div>
3636
</div>
37-
</section>
37+
</section>

_layouts/frontpage.html

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -299,24 +299,24 @@ <h4>{{forum.title}}</h4>
299299
</a>
300300
{% endfor %}
301301
</div>
302-
<div class="gitter">
303-
<h3>Real-time (topic-specialized) chat</h3>
304-
{% assign modLimit = site.data.chats-forums.gitterChannels.size | modulo: 2 %}
302+
<div class="discord">
303+
<h3>Real-time chat</h3>
304+
{% assign modLimit = site.data.chats-forums.discordServers.size | modulo: 2 %}
305305
{% capture channelLimit %}
306306
{% if modLimit != 0 %}
307-
{{site.data.chats-forums.gitterChannels.size | minus: 1}}
307+
{{site.data.chats-forums.discordServers.size | minus: 1}}
308308
{% else %}
309-
{{site.data.chats-forums.gitterChannels.size}}
309+
{{site.data.chats-forums.discordServers.size}}
310310
{% endif %}
311311
{% endcapture %}
312-
{% for channel in site.data.chats-forums.gitterChannels limit: channelLimit %}
312+
{% for server in site.data.chats-forums.discordServers limit: channelLimit %}
313313
{% if forloop.first %}
314314
<ul class="first">
315315
{% endif %}
316316
<li>
317-
<a href="{{channel.url}}">
318-
<img src="{{ site.baseurl }}/resources/img/frontpage/gitter-logo.png" alt="">
319-
<span>{{channel.name}}</span>
317+
<a href="{{server.url}}">
318+
<img src="{{ site.baseurl }}/resources/img/frontpage/discord-logo.png" alt="">
319+
<span>{{server.name}}</span>
320320
</a>
321321
</li>
322322

_overviews/FAQ/index.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ especially popular, well-known books.
3333
We don't have a list of all the Scala books that
3434
are out there; there are many.
3535

36-
You can go on the [Scala room on
37-
Gitter](https://gitter.im/scala/scala) or another community forum and
36+
You can go on the \#scala-users room [on
37+
Discord](https://discord.com/invite/scala) or another community forum and
3838
ask for book recommendations. You'll get more helpful
3939
answers if you provide some information about your background and your
4040
reasons for wanting to learn Scala.
@@ -55,8 +55,8 @@ way. In time, there will be more and more Scala 3 jobs as well.
5555

5656
This is addressed on our [Community page](https://scala-lang.org/community/#scala-jobs).
5757

58-
In short, the only officially sanctioned place is the [scala/job-board
59-
room on Gitter](https://gitter.im/scala/job-board).
58+
In short, the only officially sanctioned place is the \#jobs channel
59+
[on Discord](https://discord.com/invite/scala).
6060

6161
### Who's behind Scala?
6262

_overviews/scala3-book/domain-modeling-oop.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ There are a few things that need explanation.
197197
#### Abstract Type Members
198198
The declaration `type S <: Subject` says that within the trait `SubjectObserver` we can refer to some _unknown_ (that is, abstract) type that we call `S`.
199199
However, the type is not completely unknown: we know at least that it is _some subtype_ of the trait `Subject`.
200-
All traits and classes extending `SubjectObserer` are free to choose any type for `S` as long as the chosen type is a subtype of `Subject`.
200+
All traits and classes extending `SubjectObserver` are free to choose any type for `S` as long as the chosen type is a subtype of `Subject`.
201201
The `<: Subject` part of the declaration is also referred to as an _upper bound on `S`_.
202202

203203
#### Nested Traits

_overviews/scala3-book/types-adts-gadts.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ It is only safe to return an `Int` in the first case, since we know from pattern
168168

169169

170170
## Desugaring Enumerations
171-
_Conceptually_, enums can be thought of as defining a sealed class together with an companion object.
171+
_Conceptually_, enums can be thought of as defining a sealed class together with its companion object.
172172
Let’s look at the desugaring of our `Color` enum above:
173173
```scala
174174
sealed abstract class Color(val rgb: Int) extends scala.reflect.Enum

_overviews/scala3-macros/tutorial/quotes.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -502,5 +502,38 @@ def setOfCode[T: Type](using Quotes): Expr[Set[T]] =
502502
The difference is that, in the second scenario, we expand the macro before the implicit search is performed. We can therefore write arbitrary code to handle the case when an `Ordering[T]` is not found.
503503
Here, we used `HashSet` instead of `TreeSet` because the former does not need an `Ordering`.
504504

505+
## Quoted Type Classes
506+
507+
In the previous example we showed how to use the `Expr[Ordering[T]]` type class explicitly by leveraging the `using` argument clause. This is perfectly fine, but it is not very convenient if we need to use the type class multiple times. To show this we will
508+
use a `powerCode` function that can be used on any numeric type.
509+
510+
First, it can be useful to make `Expr` type class can make it a given parameter. To do this we do need to explicitly in `power` to `powerCode` because we have a given `Numeric[Num]` but require an `Expr[Numeric[Num]]`. But then we can ignore it in `powerMacro` and any other place that only passes it around.
511+
512+
```scala
513+
inline def power[Num](x: Num, inline n: Int)(using num: Numeric[Num]) =
514+
${ powerMacro('x, 'n)(using 'num) }
515+
516+
def powerMacro[Num: Type](x: Expr[Num], n: Expr[Int])(using Expr[Numeric[Num]])(using Quotes): Expr[Num] =
517+
powerCode(x, n.valueOrAbort)
518+
```
519+
520+
To use a this type class we need a given `Numeric[Num]` but we have a `Expr[Numeric[Num]]` and therefore we need to splice this expression in the generated code. To make it available we can just splice it in a given definition.
521+
522+
```scala
523+
def powerCode[Num: Type](x: Expr[Num], n: Int)(using num: Expr[Numeric[Num]])(using Quotes): Expr[Num] =
524+
if (n == 0) '{ $num.one }
525+
else if (n % 2 == 0) '{
526+
given Numeric[Num] = $num
527+
val y = $x * $x
528+
${ powerCode('y, n / 2) }
529+
}
530+
else '{
531+
given Numeric[Num] = $num
532+
$x * ${ powerCode(x, n - 1) }
533+
}
534+
```
535+
536+
537+
505538
[macros]: {% link _overviews/scala3-macros/tutorial/macros.md %}
506539
[quotes]: {% link _overviews/scala3-macros/tutorial/quotes.md %}

_overviews/scala3-scaladoc/settings.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ A mapping is of the form '\<regex>::\[scaladoc3|scaladoc|javadoc]::\<path>'. You
8787

8888
Links to social sites. For example:
8989

90-
`-social-links:github::https://github.com/lampepfl/dotty,gitter::https://gitter.im/scala/scala,twitter::https://twitter.com/scala_lang`
90+
`-social-links:github::https://github.com/lampepfl/dotty,discord::https://discord.com/invite/scala,twitter::https://twitter.com/scala_lang`
9191

9292
Valid values are of the form: '\[github|twitter|gitter|discord]::link'. Scaladoc also supports 'custom::link::white_icon_name::black_icon_name'. In this case icons must be present in 'images/' directory.
9393

_sass/layout/table-of-content.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@
109109
@include clearfix;
110110
padding-bottom: $padding-small;
111111
.discourse,
112-
.gitter {
112+
.discord {
113113
h3 {
114114
margin-top: 0;
115115
}
@@ -168,7 +168,7 @@
168168
}
169169
}
170170

171-
.gitter {
171+
.discord {
172172
ul {
173173
li {
174174
@include span-columns(3 of 6);

_sass/layout/talk-to-us.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
}
2626

2727
.discourse,
28-
.gitter {
28+
.discord {
2929
margin-bottom: 50px;
3030
@include clearfix;
3131
}
@@ -76,7 +76,7 @@
7676
}
7777
}
7878

79-
.gitter {
79+
.discord {
8080
ul.first {
8181
@include shift(2);
8282

_sips/sip-template.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,8 @@ process anyway so it's better to get them out up front.
110110
2. [API Documentation][2]
111111
3. [Academic/Research papers/supporting material][3]
112112
4. [Alternative Libraries/Implementations][4]
113-
5. [Discussion forum/post/gitter/IRC][5]
114113

115114
[1]: https://github.com "GitHub"
116115
[2]: https://www.scala-lang.org/api/ "Scaladoc"
117116
[3]: https://en.wikipedia.org/wiki/Academic_publishing "Academic/Research"
118117
[4]: https://github.com/dogescript/dogescript "Alternatives"
119-
[5]: https://gitter.im "Gitter"

0 commit comments

Comments
 (0)