logoalt Hacker News

pjmlplast Sunday at 4:44 PM4 repliesview on HN

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

noelwelshlast Sunday at 7:16 PM

Everything is up to date with the new syntax as far as I'm aware. Also, the compiler and scalafmt can rewrite one to the other. A project can pick whatever style it wants and have CI reformat code to that style.

show 2 replies
ergocoderlast Monday at 3:05 AM

It's on brand for Scala to have multiple ways of achieving the same thing.

Now we x2 by having the curly brace syntax and the indent syntax.

esafaklast Sunday at 5:22 PM

You could also have compared it, more attractively, to Haskell.

show 1 reply
gedylast Sunday at 4:59 PM

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
show 3 replies