18 lines
526 B
Plaintext
18 lines
526 B
Plaintext
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; }
|