Looks like JavaScript, feels like Ruby, and it is a script language fitting in C programmers.
This project is maintained by Kray-G
mixin
keyword is used in a Class definition to include Module
.
As the example below, class Value will become having methods of print
and println
by mixin
.
module Printable {
public print() {
System.print(@value);
}
public println() {
System.println(@value);
}
}
class Value(v) {
mixin Printable;
private initialize() {
@value = v;
}
}
Here is the whole code of the use case of the above example.
module Printable {
public print() {
System.print(@value);
}
public println() {
System.println(@value);
}
}
class Value(v) {
mixin Printable;
private initialize() {
@value = v;
}
}
var val = new Value(100);
val.println(); // => 100
100