diff options
author | Martin Odersky <odersky@gmail.com> | 2004-04-19 17:02:30 +0000 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2004-04-19 17:02:30 +0000 |
commit | 77f339b1011924a21e463739f9132bde850c17c6 (patch) | |
tree | 8d121abc7c7ec98ccd7ef971444e4bb641091b06 /doc | |
parent | 8ff3a9738146851ae41568c2df359c8f8fa83942 (diff) | |
download | scala-77f339b1011924a21e463739f9132bde850c17c6.tar.gz scala-77f339b1011924a21e463739f9132bde850c17c6.tar.bz2 scala-77f339b1011924a21e463739f9132bde850c17c6.zip |
*** empty log message ***
Diffstat (limited to 'doc')
-rw-r--r-- | doc/reference/ReferencePart.tex | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/doc/reference/ReferencePart.tex b/doc/reference/ReferencePart.tex index eb665d0167..d628a57c2d 100644 --- a/doc/reference/ReferencePart.tex +++ b/doc/reference/ReferencePart.tex @@ -2207,21 +2207,26 @@ which appear in the same statement sequence as the definition of A class definition which starts with the reserved word \code{trait} instead of \code{class} defines a trait. A trait is a specific instance of an abstract class, so the \code{abstract} modifier is -redundant for it. The template of a trait must satisfy the following +redundant for it. The trait definition must satisfy the following four restrictions. \begin{enumerate} -\item All base classes of the trait are traits. -\item All parent class constructors of a template - must be primary constructors with empty value +\item There are no value parameters in the trait's primary constructor, nor + are there secondary constructors. +\item All mixin base classes of the trait are traits. +\item All parent class constructors of the trait + are primary constructors with empty value parameter lists. -\item All non-empty statements in the template are either imports or pure definitions. -\item A trait may not have secondary constructors. +\item All non-empty statements in the trait's template are either + imports or pure definitions. \end{enumerate} A {\em pure} definition can be evaluated without any side effect. Function, type, class, or object definitions are always pure. A value -definition is pure if its right-hand side expression is pure. Pure -expressions are paths, literals, and typed expressions -$e: T$ where $e$ is pure. +definition is pure if its right-hand side expression is pure. A +secondary constructor definition is pure if its right-hand side +consists only +Pure +expressions are paths, literals, and typed expressions $e: T$ where +$e$ is pure. These restrictions ensure that the evaluation of the mixin constructor of a trait has no effect. Therefore, traits may appear several times |