What does "abstract type instance of a type" mean?

In Scala Language Specification, version 2.13:

Blockquote
Type volatility approximates the possibility that a type parameter or abstract type instance of a type does not have any non-null values. A value member of a volatile type cannot appear in a path.

What is “abstract type instance of a type”? A sample is appreciated.

I think it has no instance if it is abstract.

Thanks for your help!

Guofeng

1 Like

https://docs.scala-lang.org/tour/abstract-type-members.html

In the linked page, there is

abstract class SeqBuffer extends Buffer {
  type U

I know that U is the abstract type, and

abstract class IntSeqBuffer extends SeqBuffer {
  type U = Int
}

Is “type U = Int” is the instance mentioned in “abstract type instance”?

Thanks for your reply!

I don’t claim to fully understand these parts of the spec, but nobody else has stepped up with a full answer, so here’s my best effort.

There is a concept of “type instance” defined in SLS 3.2.12, the section on existential types. But after some study and thought, I can’t see how that would actually be relevant to SLS 3.6.

How do we read that wording, then?

Scala’s type system includes both type parameters and type members. These are rather similar concepts, so there are places in the spec where they are discussed together, though different language may be needed to treat each one, since they are distinct concepts. SLS 3.6 is one such place.

I think you can read “a type parameter or abstract type instance of a type” as if it simply said “a type parameter or abstract type member”, as those are two very similar things. As best I can tell, “abstract type instance” is just poor wording here. (At least, unless it’s meant to exclude existential types from consideration?)

As evidence for that, note that later in SLS 3.6, in several places it just says “type parameter or abstract type” and doesn’t mention "type instance"s at all. “Abstract type”, as best I can tell, is to be understood as “type member which has not been specified”. So e.g. in trait T { type U }, U is an abstract type member. But if I write T { type U = Int }, then U is a type member but isn’t abstract.