| 1 | (* An ERROR constant named by another is that same error; only a string |
| 2 | makes a new one (report section 5.8). *) |
| 3 | module ErrorConstNamed; |
| 4 | import Out, PictBase; |
| 5 | |
| 6 | const |
| 7 | Short*: ERROR = PictBase.Short; |
| 8 | Again: ERROR = Short; |
| 9 | Mine: ERROR = "too short"; |
| 10 | Errs: [2]ERROR = [Short, Mine]; |
| 11 | |
| 12 | proc main*; |
| 13 | var e: ERROR; |
| 14 | begin |
| 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; |
| 25 | end; |
| 26 | |
| 27 | end ErrorConstNamed. |