blob: 6dbeb85e9335c87b772dfdc303cbffa9dd9edf5f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
implement Modules;
include "sys.m";
include "draw.m";
# Note the lack of `include "persons.m";`
include "towns.m";
sys: Sys;
print: import sys;
persons: Persons;
Person: import persons;
towns: Towns;
Town: import towns;
Modules: module {
init: fn(nil: ref Draw->Context, nil: list of string);
};
init(nil: ref Draw->Context, nil: list of string) {
sys = load Sys Sys->PATH;
persons = load Persons "./persons.dis";
towns = load Towns "./towns.dis";
persons->init();
towns->init();
print("%d\n", persons->getpop());
print("%d\n", towns->persons->getpop());
p := persons->mkperson();
p.name = "Spike";
p.age = 27;
print("%d\n", persons->getpop());
print("%d\n", towns->persons->getpop());
t := towns->mktown();
t.pop = array[] of {p, ref Person(13, "Ed")};
t.name = "Mars";
print("%s\n", t.stringify());
exit;
}
|