- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
SLS Question
Tue, 2010-03-30, 22:09
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
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