Rebooting the Scala FAQ

Did you know Scala has an FAQ? If you didn’t that could be because it hadn’t been updated in years…

…until now! New version is online at https://docs.scala-lang.org/tutorials/FAQ/index.html — it’s also the first search result if you google “scala faq”, and it’s also reachable via the sca.la redirection service: https://sca.la/faq

PRs with further improvements are encouraged. Source file is https://github.com/scala/docs.scala-lang/blob/master/_overviews/FAQ/index.md

Now that I’ve laid the foundation, I’m hoping this might attract some contributor interest, and then after a while (in a few weeks, perhaps?) we could publicize it more widely.

This scratches a personal itch: I’m often answering the same questions over and over again on Gitter, I feel. From now on, I’m going to try to notice when I’m doing that, and add it to the FAQ.
And still answer, but with an FAQ link :slight_smile:

Note that I don’t foresee this turning into a huge document… there are only so many questions are actually frequently asked by newcomers to our chat rooms and forums.

16 Likes

+100 to this: the big dangers with FAQs is that the owners start writing answers to the questions they wish people would ask, or the rare-but-fun ones. A really good FAQ is empirical – you pay close attention to the questions you are actually getting often, and only answer those in it. That’s how you get a FAQ that is genuinely useful, and which people are likely to use a lot.

(I ran both the Questions Desk and FAQ for one of my clubs for about ten years – in the end, the FAQ wound up 18 questions long, and looked nothing like what the officers of the club would have guessed upfront.)

4 Likes

A post was split to a new topic: GitHub Discussions for Scala

Naftoli asked about GitHub Discussions. Oron also asked about it on Gitter. I’ve created a separate thread to talk about that in a broader context than just the FAQ: GitHub Discussions for Scala

Re: the FAQ specifically, the current FAQ happens to have a lot of Stack Overflow links, but there’s nothing tying us to that, we can link to multiple sites.

1 Like

Do we collect statistics of page visits? Maybe it’d be good to check if the all the FAQ are still FA when adding new ones with a quick glance on how often people land there. Not now, because how old and dusty everything was in that corner of the site, but maybe in the future. Then it would be good to know the infrastructure to check that is already in place.

1 Like

No clue, not sure if somebody else knows or might like to track this, that’s a bit above my ambition level here, I think.

after a series of PRs from myself and @BalmungSan, I’m feeling like this is in pretty decent shape:

https://docs.scala-lang.org/tutorials/FAQ/index.html

1 Like

It’s looking pretty good, and I learned something new from it! :slight_smile:

Nice FAQ.

I learned something new: It says List[Int] is erased to List[Object]. I was assuming that common standard collections are specialized. I guess I might use Array more often for local and private things.

5 Likes

Yeah I really hope Scala gets automatic specialisation one day. Darkdimus made a prototype of it in or with Dotty a few years back called “linker” or something and it sounded really promising. Maybe once Scala 3 is stable, something like that will be resurrected.

But yeah if you’re on Scala 2.13+, try ArraySeq for an immutable version of Array.

1 Like

It’s really too bad that the linker project was not completed. I hope it will be some day. Scala.js has its linker, Scala Native as well, and hopefully Scala JVM will get it too. It seems to me that the linker is the only viable solution for specialization, but that’s only one of the benefits of the linker which would get you all sorts of whole-program optimizations. (Maybe even unboxed options?)

4 Likes

Note that how a type erases and whether a type is specialized are separate questions. So for example Tuple2 is specialized:

scala 2.13.4> (1, 2.0).getClass
val res5: Class[_ <: (Int, Double)] = class scala.Tuple2$mcID$sp

But regardless, Tuple2[Int, Double] erases to Tuple2[Object, Object]:

scala 2.13.4> def foo(p: (Int, Double)): Double = p._1 + p._2
def foo(p: (Int, Double)): Double

scala 2.13.4> :javap foo
  ...
  public double foo(scala.Tuple2<java.lang.Object, java.lang.Object>);
  ...

scala 2.13.4> :javap scala.Tuple2$mcID$sp
...
public final class scala.Tuple2$mcID$sp extends scala.Tuple2<java.lang.Object, java.lang.Object> ...
...

Similarly, even if List were specialized on Int, List[Int] would still erase to List[Object].

2 Likes