This page is no longer maintained — Please continue to the home page at www.scala-lang.org

SLS Question

No replies
Steve Preston
Joined: 2010-03-24,
User offline. Last seen 42 years 45 weeks ago.
In the SLS, in section 3.2.3 (Type Designators), there is shown several
examples of how type designators get expanded.  In particular, the
type 'Int' is shorthand for 'scala.type#Int'.

But just a little earlier, in section 3.2.1 (Singleton Types), we see
that "A singleton type is of the form p.type,where p is a path pointing
to a value expected to conform to scala.AnyRef."

In the Int example, the '.type' follows 'scala', which is a package.
As far as I can tell, a package is not a value.  In fact, I typed
'scala' into the interpreter (well, the 2.7 one) and it complained

  <console>:5: error: package scala is not a value

So, is there another place in the SLS that mentions being able to
follow packages with '.type'?

--
Steve Preston

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland