CSnerd
CSnerd

Reputation: 2239

Why's type lattice in Scala?

I heard someone said:

"Scala uses a type lattice rather than a type hierarchy, which is different from Java".

I do not quite understand what the meaning type lattice is and what the main difference between type lattice and type hierarchy is.

Could someone explain this term to me?

Upvotes: 7

Views: 1408

Answers (1)

nitishagar
nitishagar

Reputation: 9413

Its essentially means that : The type hierarchy for Scala is a lattice, i.e. it has a “bottom” as well as a “top”.

enter image description here

As seen from the image the top type here is Any and the bottom is Nothing.

Upvotes: 9

Related Questions