Live data from Hacker News

Scala 3.0

github.com

21–30 of 292 posts

Re: Scala 3.0

#23

Always wanted to look into Scala but it seemed very intimidating. Is there a good intermediate 'How to' for Scala 3 anyone can recommend?

In no particular order:

- If you're at least a little familiar with Java, Scala for the Impatient is pretty good, though a little dated (I think the last edition covers Scala 2.12).

- Daniel Westheide's blog: https://danielwestheide.com/books/the-neophytes-guide-to-sca...

- https://www.scala-exercises.org (at least the part on the standard library).

- https://www.handsonscala.com

Note: Scala 3 introduces quite a bit of new syntax that is specifically designed to make intimidating features less so. But at the beginner/intermediate level it won't matter too much, for instance if you learn how to implement typeclasses the old way, you'll easily understand the new syntax. Also the Scala Center has committed to providing a lot of training material along with the Scala 3 release.

Re: Scala 3.0

#24

Scala is not perfect but it’s very good. It’s competitive pressure arguably improved Java (streams, pattern matching, data classes).

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.

Re: Scala 3.0

#25

Always wanted to look into Scala but it seemed very intimidating. Is there a good intermediate 'How to' for Scala 3 anyone can recommend?

If you know Java then you can start by writing very Java-like code using the same libraries you would in Java - there are a lot of intimidating functional techniques available but you don't have to use them from day 1 (indeed I'd say you probably shouldn't use them until you understand why you would want to). IMO you're much better off picking a small corner of a JVM project (e.g. maybe a migration tool or a couple of tests) and using a little Scala in practice, rather than trying to learn it all to start with.

Re: Scala 3.0

#26
post #15

Earlier quoted context omitted.

No. It's a Singleton type, which means that instead of just being a String, it has to be exactly the String "Scala". i.e. val x: "scala" = "scala" // would compile val y: "scala" = "java" // would produce a compile error Union types are an orthogonal concept, and work as you'd expect: val z: String | Int = "foo"

Interesting, and I presume it works for singletons of any type, correct? val x: 1 = 1 val y: 2.718281828 = 2.718281828 That's kind of cute. I presume its main purpose is for overrides in order to get something similar to template specialization. C++ templates can be specialized by types and by values, but Scala method overrides are only by type, and literal types allow you to present a value as a type, so if the valu…

It's not really about specialization (types in Scala tend to be parametric most of the time) so much as just being able to have values in types, so that you can have types like "ListOfLength[1]" or "MapContainingKeys["Foo" :: "Bar" :: Nil]" without having to do some horrendous encoding of those things as types.

Re: Scala 3.0

#28
post #17
post #4

I get paid to write TypeScript, it has come a long way to a relatively enjoyable experience compared to how expressive i feel with Scala. Looking forward to giving Scala 3 a spin to learn whats new

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…

It helps that Erich Gamma and Anders Hejlsberg are on the team, with deep experience in developer tooling.

Re: Scala 3.0

#29

Scala is not perfect but it’s very good. It’s competitive pressure arguably improved Java (streams, pattern matching, data classes).

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

How so? Kotlin doesn't even have proper pattern matching.

Re: Scala 3.0

#30
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.

[deleted]
Post reply on HN