t_fwdtype.mod 441 B

123456789101112
  1. MODULE tfwdtype;
  2. // REJECTED BY DESIGN: a module-level forward type reference (a global
  3. // whose type is declared further down). Modula-2 requires declaration
  4. // before use; only a POINTER's base type may forward-reference. gm2
  5. // accepts this as a leniency. Expects "undeclared identifier".
  6. VAR g : Later;
  7. TYPE Later = RECORD x, y : INTEGER END;
  8. VAR ExitCode : INTEGER;
  9. BEGIN
  10. g.x := 40; g.y := 2;
  11. ExitCode := g.x + g.y
  12. END tfwdtype.