unrecognizable code in scala Predef object

scala

Solution

(Link). I can only guess. When you use a singleton object as expression, this has the same effect as forcing the evaluation of a `lazy val`, in other words it will run the object's body if it wasn't yet initialised.

For example:

object Foo {
  println("Foo is launching rockets...")
}

Now when you write just

Foo   // prints `Foo is launching rockets...`

this enforces the evaluation of the contents of `Foo`.

So my guess is that in `Predef` this just makes sure that certain things in the `scala` package object and in `List` are initialised. Very unlikely something you would bother as a user.

Problem

Can someone please explain the following code in Predef object? Thanks. ``` scala.`package` // to force scala package object to be seen. scala.collection.immutable.List // to force Nil, :: to be seen. ```

Original source