Search in the blog:

2024-12-06

Scala 3: How to disable significant indentation (Gradle)

Overall, I like the changes in Scala 3. Most of them are actually simplify Scala programming. But I hate significant indentation (indentation-based syntax).

Meanwhile, I have become friends with Haskell's indentation-based syntax, but Scala's significant indentation made the syntax very fragile. It is very annoying.

So I disable significant indentation whenever possible. (With Scala 3) I use Gradle instead of sbt. To turn off significant indentation in a Gradle project:

tasks.withType(ScalaCompile) {
    // disable significant indentation
    scalaCompileOptions.additionalParameters = ['-no-indent']
}

Anyway, programming in Scala 3 tends to make me use braces (curly brackets) even more (in a Rust-way).

0 comments:

Post a Comment

Blog Archive