Initial Commit
This commit is contained in:
706 files changed
+135430
No files matched your search
@@ -0,0 +1,18 @@
|
||||
import std::io;
|
||||
import lib;
|
||||
import lib::inner;
|
||||
def main(): void {
|
||||
var c := start();
|
||||
c.bump();
|
||||
println($"{c.n} {label()} {total()}");
|
||||
}
|
||||
module lib;
|
||||
pub struct counter { pub var n: int; }
|
||||
def step(): int { return 2; }
|
||||
pub def counter::bump(&mut this): void { this.n = this.n + step(); }
|
||||
pub def total(): int { return step() + deeper::extra(); }
|
||||
module lib::inner;
|
||||
pub def start(): counter { return counter{ n = step() }; }
|
||||
pub def label(): string { return "inner"; }
|
||||
module lib::deeper;
|
||||
pub def extra(): int { return 5; }
|
||||
Reference in new issue
Block a user