How to create a singleton object in Scala with runtime params
Singletons are initialized lazily.
scala> :pa
// Entering paste mode (ctrl-D to finish)
object Net {
val address = Config.address
}
object Config { var address = 0L }
// Exiting paste mode, now interpreting.
defined object Net
defined object Config
scala> Config.address = "1234".toLong
Config.address: Long = 1234
scala> Net.address
res0: Long = 1234
FWIW.