| | @@ -441,8 +441,11 @@ |
| 441 | 441 | ### 5.10 Same and assignable |
| 442 | 442 | |
| 443 | 443 | Two named types are the same only if they are the same declaration. |
| 444 | | -Two anonymous types are the same if they are built alike: `^I64` is |
| 445 | | -`^I64` wherever it is written. A named and an anonymous type are the |
| 444 | +Two anonymous pointer, array, slice, set or procedure types are the |
| 445 | +same if they are built alike: `^I64` is `^I64` wherever it is written. |
| 446 | +A record, variant or enumeration, though, is a type of its own wherever |
| 447 | +it is written, named or not: two `record x: I64; end` are two types. |
| 448 | +A named and an anonymous type are the |
| 446 | 449 | same if the named one is built like the anonymous one, so that |
| 447 | 450 | `p := ADR(n)` works for `p: NodePtr` with `type NodePtr = ^Node`. |
| 448 | 451 | Sameness doesn't pass through the anonymous type: with `type P1 = |
| | @@ -996,10 +999,12 @@ |
| 996 | 999 | pointer, a code procedure that breaks its rules, and C code can read or |
| 997 | 1000 | write any memory, and what follows isn't defined. Dereferencing `nil`, dividing |
| 998 | 1001 | by zero, calling a `nil` procedure and running out of stack stop the |
| 999 | | -program with a signal. Before it stops, the program prints to standard |
| 1000 | | -error where it was, as file, line and column, and why, as far as it can |
| 1001 | | -tell: a `nil` pointer, a `nil` procedure, a stack overflow, a bad |
| 1002 | | -address or a division fault. |
| 1002 | +program, on every target. Before it stops, the program prints to |
| 1003 | +standard error where it was, as file, line and column, and why, as far |
| 1004 | +as it can tell: a `nil` pointer, a `nil` procedure, a stack overflow, a |
| 1005 | +bad address or a division fault. Whether the machine catches these or |
| 1006 | +the compiled code checks for them is the implementation's choice |
| 1007 | +(appendix A); that they stop the program isn't. |
| 1003 | 1008 | |
| 1004 | 1009 | **Messages.** The compiler reports an error with its file, line and |
| 1005 | 1010 | column, the line of source with the offending part underlined, and, |
| | @@ -1518,7 +1523,10 @@ |
| 1518 | 1523 | - **2026-10.10.** Said at last: what the compiler did and the report |
| 1519 | 1524 | didn't say, all through; what an implementation chooses, and the |
| 1520 | 1525 | core every target has (appendix A); the whole grammar (appendix B); |
| 1521 | | - the library's module names are kept for it (section 3). Mended: |
| 1526 | + the library's module names are kept for it (section 3); a record, |
| 1527 | + variant or enumeration is a type of its own wherever it is written |
| 1528 | + (section 5.10); a `nil` pointer, a division by zero and a stack |
| 1529 | + overflow stop the program on every target (section 10). Mended: |
| 1522 | 1530 | arithmetic on untyped constants that overflows is an error (section |
| 1523 | 1531 | 2); a slice of a pointer can't run backwards (section 6.4). Ordinary |
| 1524 | 1532 | accesses are no longer promised to be made exactly as written, only |
| | @@ -1543,6 +1551,10 @@ |
| 1543 | 1551 | layout is the target's C layout (section 5.5). |
| 1544 | 1552 | - **The executable.** Its format, and the names and line numbers it |
| 1545 | 1553 | carries for a debugger (section 10). |
| 1554 | +- **How a failure is caught.** A `nil` pointer, a division by zero or |
| 1555 | + a stack overflow may be caught by the machine or by checks in the |
| 1556 | + compiled code; either way the program stops with its message |
| 1557 | + (section 10). |
| 1546 | 1558 | - **Messages and warnings.** The text of the compiler's messages, how |
| 1547 | 1559 | many errors it reports before it stops, and which warnings it gives |
| 1548 | 1560 | (section 10). A program that is an error in this report is one in |
| | @@ -1554,7 +1566,7 @@ |
| 1554 | 1566 | give: `Sys` past writing, ending the program and getting memory, |
| 1555 | 1567 | `Thread`, `link` and `extern`. What it must have, besides the whole |
| 1556 | 1568 | language, is the core of the library: `Rt`, `Out`, `Mem`, `Arena`, |
| 1557 | | -`Lock`, `Str`, `Buf` and `Fmt`, and of `Sys` what they need. A |
| 1569 | +`Lock`, `Str` and `Buf`, and of `Sys` what they need. A |
| 1558 | 1570 | program that keeps to the core runs on every target. |
| 1559 | 1571 | |
| 1560 | 1572 | ## Appendix B. The grammar |