←back to thread

Scala 3 slowed us down?

(kmaliszewski9.github.io)
261 points kmaliszewski | 2 comments | | HN request time: 0s | source
Show context
pjmlp ◴[] No.46183020[source]
The only issue I have with Scala 3 is Python envy, they should not have come up with a second syntax, and pushing it as the future.

If anything is slowly down Scala 3 is that, including the tooling ecosystem that needs to be updated to deal with it.

replies(4): >>46183121 #>>46183318 #>>46184223 #>>46187857 #
gedy ◴[] No.46183121[source]
As a former Scala fan, wow you aren't kidding, wth

    val month = i match
        case 1  => "January"
        case 2  => "February"
        // more months here ...
        case 11 => "November"
        case 12 => "December"
        case _  => "Invalid month"  // the default, catch-all
    
    // used for a side effect:
    i match
        case 1 | 3 | 5 | 7 | 9  => println("odd")
        case 2 | 4 | 6 | 8 | 10 => println("even")
    
    // a function written with 'match':
    def isTrueInPerl(a: Matchable): Boolean = a match
        case false | 0 | "" => false
        case _ => true
replies(3): >>46183181 #>>46183392 #>>46185346 #
1. jfim ◴[] No.46183392[source]
It's been a while since I touched Scala but wasn't that a thing in previous versions, minus the braces not being present?
replies(1): >>46184422 #
2. weego ◴[] No.46184422[source]
Yes, that's all just as it was, and in places braces were not required / interchangeable so this is more of an optional compiler choice than a real change