raz / conform / run / ErrorConstNamed.raz

27 lines · 805 B · raw · history · last change 73c1f3ac

1(* An ERROR constant named by another is that same error; only a string
2 makes a new one (report section 5.8). *)
3module ErrorConstNamed;
4import Out, PictBase;
5
6const
7 Short*: ERROR = PictBase.Short;
8 Again: ERROR = Short;
9 Mine: ERROR = "too short";
10 Errs: [2]ERROR = [Short, Mine];
11
12proc main*;
13var e: ERROR;
14begin
15 e := PictBase.read(2);
16 if e = Short then Out.str("same "); end;
17 if Short = PictBase.Short then Out.str("same "); end;
18 if Again = PictBase.Short then Out.str("same "); end;
19 if Errs[0] = e then Out.str("same "); end;
20 if Mine # PictBase.Short then Out.str("different "); end;
21 if Errs[1] # e then Out.str("different "); end;
22 if Short # PictBase.Bad then Out.str("different "); end;
23 Out.str(MSG(Again));
24 Out.ln;
25end;
26
27end ErrorConstNamed.