In article <10bbp43$2fsef$1@dont-email.me>,
Janis Papanagnou <janis_papanagnou+ng@hotmail.com> wrote:
I basically agree with that. But, that said, I'm obviously not used
to these castings and the user-defined type-specific NIL definitions.
My intention here was to get a better feeling for this approach.
If I inspect my Algol 68 textbook from the 1970's I also cannot find
a single use of such a code pattern. - Concerning my use of Algol 68
I'm very biased by its contents, and by the university teaching I
got. - There was just a single context type for such REF casts, and
no "own" 'nil' ever required.
The ALGOL 68-R Users Guide gives an example of a linked list type:
MODE LINK = STRUCT(INT item, REF LINK next);
It recommends declaring a null reference for the end of the list:
REF LINK empty = NIL;
The reason why this is preferable is that it enables us to test for the
end of the chain by means of the clause
next OF d IS empty
The mode of 'empty' causes 'next OF d' to be dereferenced to REF LINK
There's a copy of the guide at
https://github.com/coolbikerdad/Algol-68-Publications/blob/main/Algol68-R%20Users%20Guide.pdf
| Sysop: | Amessyroom |
|---|---|
| Location: | Fayetteville, NC |
| Users: | 59 |
| Nodes: | 6 (0 / 6) |
| Uptime: | 24:14:35 |
| Calls: | 810 |
| Calls today: | 1 |
| Files: | 1,287 |
| D/L today: |
12 files (21,036K bytes) |
| Messages: | 195,978 |