scala / docs.scala-lang

The Scala Documentation website
http://docs.scala-lang.org
559 stars 1.02k forks source link

add explanation in book that indentation is significant #2266

Open A-Roso opened 2 years ago

A-Roso commented 2 years ago

There is no explanation in the book that indentation is significant and needed for the compiler. When searching for 'Indentation' it is only referenced in the Style Guide, Migration Guide and Language Reference. I think for new learners that start learning Scala with Scala3 and the Scala3 book, it would be very helpful to add a few lines of explanation e.g. in A Taste of Scala - Control Structures or even a chapter of its own, that indentation is significant and must be adhered to.

SethTisue commented 2 years ago

@alvinj

alvinj commented 2 years ago

Hi @SethTisue. Unfortunately I have to focus on paid work at the moment, but yes, if we didn’t mention that, it should be added. I’ll be glad to do this as part of some volunteer work again next year, but honestly, it won’t be until somewhere around March-June.

SethTisue commented 2 years ago

maybe someone else would like to pick this up.

Shorla commented 2 years ago

Hi @SethTisue, I am new here but would love to contribute to scala docs. can I be assigned to this issue?

SethTisue commented 2 years ago

sure, go for it!

Shorla commented 2 years ago

should i move the explanation here:https://docs.scala-lang.org/style/indentation.html to scala book?

bishabosha commented 2 years ago

should i move the explanation here:https://docs.scala-lang.org/style/indentation.html to scala book?

this explanation is for Scala 2, where indentation is only a style preference. You could adapt from the official reference for Scala 3's indentation (but it is not very beginner friendly)

alvinj commented 2 years ago

This is actually a pretty fundamental thing that I missed in the book. I agree with the initial comment that it could go in the Control Structures section, since that’s where it’s first shown, or just prior to that section.

FWIW, I also see on that Control Structures page that I left the Scala 2 example indented with four spaces, which is not consistent with the rest of the page.