| | @@ -64,7 +64,8 @@ |
| 64 | 64 | while xor |
| 65 | 65 | ``` |
| 66 | 66 | |
| 67 | | -`static`, in `link static;` (section 3), isn't one. |
| 67 | +`static`, in `link static;` (section 3), and `check` and `off`, in |
| 68 | +`check off;` (section 3), aren't reserved. |
| 68 | 69 | |
| 69 | 70 | **Predeclared names** are the basic types (section 5.1), `ERROR`, |
| 70 | 71 | `true`, `false`, `nil` and the built-in procedures (section 6.8). They |
| | @@ -276,8 +277,7 @@ |
| 276 | 277 | whatever memory it reaches, and what follows isn't defined. Every other |
| 277 | 278 | check stays, and the module's callers keep theirs. An instance of a |
| 278 | 279 | generic module follows the generic module's own `check` line, not that |
| 279 | | -of the module that made it. `check` and `off` aren't reserved words, as |
| 280 | | -`static` isn't. |
| 280 | +of the module that made it. |
| 281 | 281 | |
| 282 | 282 | ## 4. Declarations |
| 283 | 283 | |
| | @@ -576,7 +576,9 @@ |
| 576 | 576 | between `F32` and `F64`, without a written conversion (section 6.7). |
| 577 | 577 | Results passed on whole need the same types exactly: in `a, b := |
| 578 | 578 | f(x)` and in `return f(x)`, an `INT` result doesn't pass up as an |
| 579 | | -`I64`. Elsewhere, `return n, n` included, an `INT` widens as above. |
| 579 | +`I64`. Elsewhere, `return n, n` included, an `INT` widens as above; the |
| 580 | +bounds of a `for` and the step of `INC` and `DEC` take the type of the |
| 581 | +variable they work on, and an `INT` is not widened to it. |
| 580 | 582 | |
| 581 | 583 | ## 6. Expressions |
| 582 | 584 | |
| | @@ -645,7 +647,8 @@ |
| 645 | 647 | for `x: U8`, `x shl 9` is `x shl 1`. `shr` brings in copies of the |
| 646 | 648 | sign bit for signed types and zeros for unsigned ones. `n` may be of |
| 647 | 649 | any integer type. The result has `x`'s type, cut to its width: in |
| 648 | | -`U8`, `0C0H shl 1` is `80H`. |
| 650 | +`U8`, `0C0H shl 1` is `80H`. If `x` is an untyped constant, so is the |
| 651 | +result, and it doesn't wrap: `1 shl 9` is 512, which doesn't fit a `U8`. |
| 649 | 652 | |
| 650 | 653 | Relations compare as signed or unsigned according to the type. |
| 651 | 654 | |
| | @@ -761,9 +764,10 @@ |
| 761 | 764 | |
| 762 | 765 | There are no others: no conversion between `BOOL` and integers, none |
| 763 | 766 | between pointers and integers other than `INT` and `UINT`, and none to |
| 764 | | -or from records, arrays, slices, variants or `ERROR`. A |
| 765 | | -conversion of a constant is made by the compiler, by the same rules: |
| 766 | | -`U8(300)` is 44. |
| 767 | +or from records, arrays, slices, variants or `ERROR`. An untyped integer constant converts to a pointer as an `INT` does, as |
| 768 | +in `^VOLATILE U32(0FEE00000H)`; it isn't assigned to a pointer without |
| 769 | +the conversion. A conversion of a constant is made by the compiler, by |
| 770 | +the same rules: `U8(300)` is 44. |
| 767 | 771 | |
| 768 | 772 | ### 6.8 Built-in procedures |
| 769 | 773 | |
| | @@ -895,7 +899,8 @@ |
| 895 | 899 | end; |
| 896 | 900 | ``` |
| 897 | 901 | |
| 898 | | -`match` runs the arm of the case `s` holds. An arm may name the case's |
| 902 | +`match` takes a variant, an enumeration or an integer type (a `U8` |
| 903 | +included); other types are an error. It runs the arm of the case `s` holds. An arm may name the case's |
| 899 | 904 | fields, in order, all of them; the names stand for those fields of `s` |
| 900 | 905 | itself, so assigning to one changes `s`; if `s` isn't a variable, they |
| 901 | 906 | stand for the fields of a copy. An arm may also leave the fields |
| | @@ -929,8 +934,9 @@ |
| 929 | 934 | ``` |
| 930 | 935 | |
| 931 | 936 | A label is a constant, or `lo .. hi`, the constants from `lo` to `hi`, |
| 932 | | -both included (unlike a slice, which leaves `hi` out). Each must fit |
| 933 | | -the integer's type, and no value may be in two labels. An integer |
| 937 | +both included (unlike a slice, which leaves `hi` out; `lo` may not be |
| 938 | +above `hi`). Each must fit the integer's type, and no value may be in |
| 939 | +two labels. An integer |
| 934 | 940 | `match` must have an `| else:` arm, which may be empty. Whether an arm |
| 935 | 941 | names a case or gives labels is set by the type matched: `| Max:` is a |
| 936 | 942 | case of a variant or an enumeration, and a constant for an integer. |
| | @@ -1004,8 +1010,8 @@ |
| 1004 | 1010 | ``` |
| 1005 | 1011 | |
| 1006 | 1012 | `return e;` evaluates `e` before the deferred statements run. A |
| 1007 | | -deferred statement can't contain `return`, `break`, `defer` or `try` |
| 1008 | | -that would leave it. A failed check, `Rt.exit` and `Sys.exit` end the |
| 1013 | +deferred statement can't contain `defer`, nor a `return`, `break` or |
| 1014 | +`try` that would leave it. A failed check, `Rt.exit` and `Sys.exit` end the |
| 1009 | 1015 | program without running the deferred statements still pending. |
| 1010 | 1016 | |
| 1011 | 1017 | ### 7.8 Try |