8

I am now reading the book Programming in Scala. In chapter 11, it mentioned:

Note that the value class space is flat.

But no one explain what it means. Is it important? Why? And how to use and how to check value class space is really flat. It seems that ,it should told that ref class space is not flat, but no, and no other words say it again. So I want to know what the meaning of "space is flat", and why value class space is flat.

michid
  • 10,536
  • 3
  • 32
  • 59
Wang Lihe
  • 95
  • 7
  • 3
    Perhaps it is referring to the *special* types under `AnyVal` like `Int` and `Long`? There are no descendants. –  Sep 25 '11 at 04:04
  • @pst, yes I think that's it, the next sentence is: *"all value classes are subtypes of scala.AnyVal, but they do not subclass each other"*. – huynhjl Sep 25 '11 at 04:22
  • @huynhjl,When I read this, an idea "flat memory" run in my mind, so I thought for a while about memory space behind class, it is wrong way. – Wang Lihe Sep 27 '11 at 23:19

1 Answers1

6

A flat class hierarchy is one with lots of sibling classes and few or no subclasses (none in this particular case).

Chuck
  • 234,037
  • 30
  • 302
  • 389