I am reading Programming in Scala, and I don’t understand the following sentence (pdf p.112):
Each singleton object is implemented as an instance of a synthetic class referenced from a
static variable, so they have the same initialization semantics as Java statics.
Does this mean the if I have a singleton FooBar in scala, the compiler will create a class named FooBar$?
Also what does the author mean by “referenced from a static variable”? Is there a hidden static variable somewhere holding a reference to some FooBar$ class?
I appreciate any help here.
The chapter 31 of the same “Programming in Scala” is more precise: