Turin
Turin

Reputation: 2250

Do volatile types still exist in Scala 3?

I can't find the equivalent SLS for Scala 3. I am trying to slowly get myself into the Scala 3 mindset and write new code - and refactor old when next changed - so that its translation to Scala 3 is straightforward. Certain current usecases of type projections came to as a (very) indirect result of avoiding volatile class members.

Upvotes: 3

Views: 276

Answers (1)

Dmytro Mitin
Dmytro Mitin

Reputation: 51683

I'll copy my comment from here:

Volatile types is a Scala-2 thing. They were a workaround to avoid issues caused by unsoundness of type projections:

Cannot override a type with non-volatile upper bound

In Scala 3 (general) type projections are dropped

https://dotty.epfl.ch/docs/reference/dropped-features/type-projection.html

Upvotes: 4

Related Questions