|
Scala example source code file (S5.scala)
The Scala S5.scala source code
/* Here's a fragment of a Scala encoding for the Keris module system;
** the compiler claims:
**
** S5.scala:28: value n in class N of type N.this._N.n
** cannot override value n in class M of type M.this._N.n
** val system = new M() with N() {}
** ^
** To me it seems like the code is perfectly fine...
*/
abstract class M() {
val _N: N;
val n: _N.n;
val _M: M = this;
val m: _M.m = new _M.m();
class m() {
// module body of M
}
}
trait N {
val _N: N = this;
val n: _N.n = new _N.n();
val _M: M;
val m: _M.m;
class n() {
// module body of N
}
}
object O {
val system = new M() with N {}
}
Other Scala examples (source code examples)Here is a short list of links related to this Scala S5.scala source code file: |
| ... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.