Live data from Hacker News

Scala 3.0

github.com

31–40 of 292 posts

Re: Scala 3.0

#31
Is the compiler multithreaded ?

how far it supports inlining of types and data structures to achieve or get near to zero cost abstraction after normal warm up of the code on JVM ?

Re: Scala 3.0

#32
post #10

Earlier quoted context omitted.

This creates two types with quotes in their type names, and then creates a union type of the two? Then the compiler needs to determine if the token's context requires a type or a value, and disambiguate accordingly? In the example above, the created type "Scala" is distinct from a type Scala, correct? I did some quick poking around for Scala literal types, but I found stuff like https://github.com/jeremyrsmith/litera…

Literal types quite simply means that values are types. For example in TypeScript the literal type "Foo" is a special string type, where the only valid value is the literal "Foo" – assigning "Bar" to a variable with the type "Foo" is a compile time type error. Literal types can be combined into union types like any other type.

Sounds like more Scala sophistry. I thought they were supposed to be aiming for pragmatism with Scala 3.

Re: Scala 3.0

#34

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.

It doesn't matter "who did the trick". It is well known that Java was influenced by ideas in other programming languages from the beginning. And also other languages - including Scala and Kotlin - are similar in this respect... So yes: Kotlin influenced Java and Java influenced Kotlin. Let's compare final products with final products and not "how did we get there"...

Re: Scala 3.0

#35

Is the compiler multithreaded ? how far it supports inlining of types and data structures to achieve or get near to zero cost abstraction after normal warm up of the code on JVM ?

http://dotty.epfl.ch/docs/reference/metaprogramming/inline.h...

But it's there for meta-programming purposes, not micro-optimizations. I don't think trying to outsmart the JVM at inlining is worth it.

Re: Scala 3.0

#36

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

The thing with Scala is it depends on the pattern you want to use. I am a big advocate of it, and the function pattern being used fully with something like Cats or ZIO. However I would not suggest starting there.

I would start by playing about with the syntax and writing standard OOP code, as its probably what you're most familiar with.

When you want to dive into the power of FP then I recommend http://eed3si9n.com/herding-cats/. Its basically a companion to the Haskell book 'Learn you a haskell' (http://learnyouahaskell.com/) that takes the theory coming up in that book and translates it to Scala. I found it the most direct explanation of the different types and theories (Monads, Functors, Applicative, etc).

Re: Scala 3.0

#37
Amazing!!! Great to see Scala improving at such a fast pace!

I'm especially excited about union/intersection types. I think we could all witness how well they work out in typescript and I believe that every language with the concept of subtyping should have this feature. It is one of the things that make working in a statically typed language feel much more dynamic/lightweight without giving up on safety guarantees.

Re: Scala 3.0

#38

I presume from the major increment this is a breaking change. What will tangibly be broken with 3.0, and is there any migration tooling? — Nevermind, https://scalacenter.github.io/scala-3-migration-guide/ seems to cover this quite respectably.

Yes - and in particular, Scala 3.0 makes use of TASTy, which will reduce backwards/compatibility issues a lot for future development.

Luckily Scala has one of the strongest statical type-systems, which will make migrating much smoother (not completely painless though)

Re: Scala 3.0

#39

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.

Scala was probably the major factor here. However, the fact that Kotlin picked up these features from Scala (or at least inspired it) also proves that they are mature/stable and this has always been important for Java - so Kotlin did have an impact as well.

Re: Scala 3.0

#40
post #6
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

I was looking at dotty/scala 3 earlier in the year and I was quite surprised to see familiar friends from Typescript in the form of literal types and union types. val scala: "Scala" = "Scala" const typescript: "Typescript" = "Typescript" "Scala" | "Typescript"

Literal types ("Scala" instead of String) existed before typescript to my knowledge. But union types are such a great thing. I'm very happy to see Scala catching up with typescript, as it has proven to work out really well.
Post reply on HN