Hacker News new | past | comments | ask | show | jobs | submit login
On Scala 3's Optional Braces (alexn.org)
2 points by vips7L on Oct 25, 2022 | hide | past | favorite | 2 comments



Luckily to the extrem good typesystem and focus on functional programming, a lot of issues with significant whitespace are only annoying but not dangerous in Scala.

For instance, in my code base a syntax like

    if (x > 0)
      foo(x)
      bar(x)
is always a bug and will essentially never compile. Because if-expressions always return and their result is used.

    val result = if (x > 0)
      foo(x)
      bar(x)
This will overall just result in a compile error.

Still, it can be annoying especially when using c&p or dealing with legacy code / java code where everything is a string. Therefore I also don't think it's really worth it.


This variant deserves its own title.

Contenders:

1. Scathon

2. Scalon

3. Pyala




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: