module FirstUse; import Out, Str, Table := Table([]const U8, Colour, Str.hash, Str.eq), Ints := Pile(I64), More := Pile(I64), Never := Loud(I64), Ones := Loud(U8); import SYSTEM; type Colour = (red, green, blue); var names: Table.Table; (* Table is made here, after Colour *) proc show(k: []const U8); var c: Colour; found: BOOL; begin c, found := Table.get(SYSTEM.ADR(names), k); Out.str(k); if not found then Out.str(" -"); elsif c = red then Out.str(" red"); else Out.str(" not red"); end; Out.ln; end; (* Ones is first used in a procedure, and made before its code *) proc main*; var a: Ints.Pile; b: More.Pile; begin a := b; (* two imports, one instance *) if a.len = 0 then Out.str("an empty list\n"); end; Out.str("in main, Ones has size "); Out.int(Ones.size); Out.ln; show("sky"); show("rose"); show("grass"); end; begin _ := Table.put(SYSTEM.ADR(names), "rose", red); _ := Table.put(SYSTEM.ADR(names), "sky", blue); end FirstUse.