Live data from Hacker News

Scala 3.0

github.com

91–100 of 292 posts

Re: Scala 3.0

#91
post #12

Earlier quoted context omitted.

I played with it a bit because I really like TS's union, literal types and smart-casting, unfortunately it doesn't seem quite there yet and I found it only usable for T | null types. Syntax is all there so maybe it'll get better in 3.1+

Would be interesting if you can provide some examples. I'm happy to check them and turn them into tickets / feature requests for you.

I encountered them quite soon, e.g. something like this [1]:

   val result: Int | "INTERNAL_SERVER_ERROR" = 1
   val m: Int = result match {
      case "INTERNAL_SERVER_ERROR" => throw new Exception("Uh oh")
      case t => t
    }
It does work with a ClassTag and t: T, but then it thinks the match is not exhaustive. Compare that to Typescript [2].

In this specific language feature TS is kinda the gold standard. For example they can automatically narrow the type based on fields existing or not and their type, which can be used to provide a pretty decent implementation of sum types [3]

[1] https://scastie.scala-lang.org/oMdkLBIiRsqUkXv6qbP61g

[2] https://www.typescriptlang.org/play?#code/MYewdgzgLgBATgUwgV...

[3] https://www.typescriptlang.org/docs/handbook/unions-and-inte...

Re: Scala 3.0

#92
post #24

Earlier quoted context omitted.

I think apart from streams it was Kotlin that did the trick.

Both are guest languages, Java owns the platform. What did the trick are the other programming languages that can stand on their own as platforms.

Scala can compile to JS or LLVM. Why owning a platform when amazing ones already exist?

Re: Scala 3.0

#93

I am excited about Scala 3. Scala is a powerful tool that can make teams hyperproductive. Here are the tooling shifts that can broaden the Scala 3 userbase: * Community switching from SBT to Mill * Community agreeing on automated code formatting and everyone using the same scalafmt settings. After using automated code formatting tools like black for Python and gofmt, programmers really don't want to talk about whites…

Speaking of Li's work, he's also done a lot to improve the REPL and scripting experiences for Scala. Combined with Scala 3, this is great for rapid prototypes, simple tools, and glue.

Re: Scala 3.0

#94
I'm so psyched about this. I've followed the development of Scala 3 for pretty much the whole voyage, and I think they've done an incredible job bringing the community along through some pretty radical changes to the language. It has definitely not been an easy process herding a community with very big, informed, divergent opinions on the language.

In the end, I think they did an awesome job. Many, many sacred cows of old Scala were confronted. I think the result is a much more approachable language, where simple things are easier.

Re: Scala 3.0

#95
post #86
post #77

Earlier quoted context omitted.

Graal Native takes JVM bytecode as input, and Scala 3 is binary compatible with Scala 2, so it should be compatible with Graal Native out of the box.

Does Scala 3 not advance the capabilities of Scala Native, making GaalVM unnecessary (if still an option) for running Scala without the JVM?

Scala Native and GraalVM Native Image are projects with different goals, so I wouldn't say that one makes the other unnecessary.

Both projects aim to compile to native code, and have use-cases for projects where the JVM startup time is too high. However, one of the main goals of Native Image is to offer as much partial evaluation (PE) at compile-time as possible. Scala Native does also seem to do some PE, but my understanding is that it's less than what Native Image does. However, Scala Native has the advantage of working on a representation of the source code instead of the byte code, and may therefore be able to do certain Scala-specific optimizations that would be more difficult for Native Image.

I think different projects may find that either one or the other project may be more suitable to their needs, so I think both projects can coexist.

Re: Scala 3.0

#97
Scala 3 + VS code + worksheets is my favourite exploratory programming environment. Its has:

* Powerful functional features

* Powerful OO features

* Imperative features

* Powerful type system

* Great stdlib

* Great syntax

* Very fast write/test cycle with worksheets, way better than a REPL

* Great IDE features such as autocomplete

Scala may not be the best on any one axis, but the combination is unparalleled.

Re: Scala 3.0

#98
post #17

Earlier quoted context omitted.

As someone who has spent a lot of time diving deep into Scala (I worked on compiler related semantic tooling for scalameta, worked on a experimental parallelizable Scala compiler, and even have a single commit in this release from almost four years ago LOL), and who more recently has been working with TypeScript, I find this really interesting and agree in some ways. Scala 2.x already had path-dependent types, which…

TS is great but lack of pattern matching cripples the language somewhat

It helps that is has good smart-casting, you can do with an if where other languages need pattern matching

    const x: { t: 'A', foo: string } | { t: 'B', bar: string } = /*...*/
    return x.t === 'A' ? x.foo : x.bar

Re: Scala 3.0

#99

> Fix typo in file name #12181 Tasty: set experimental to zero #12438 Ah key commits that you just know you have to bump the version up after receiving.

Those are only the commits between 3.0.0-RC2 and 3.0.0

Re: Scala 3.0

#100

I can't find this anywhere, maybe someone could help answer: 1. How much better is the performance? (In terms of compilation speed, and runtime) 2. Compatibility with Graal Native?

https://xuwei-k.hatenablog.com/entry/2021/05/14/210911

Someone did some tests on Scalaz codebase and Scala 3 is around 2.5x faster. While Scalaz (and Cats) isn't exactly like your typical Scala production code base, I think we should see noticeable improvement across all kinds of Scala code.

Post reply on HN