| | @@ -63,11 +63,13 @@ |
| 63 | 63 | but nearly every other language takes it, and the error ("expected an |
| 64 | 64 | expression, found -") surprises. |
| 65 | 65 | |
| 66 | | -The proposal: `"-" Factor` is a factor too. Where the two readings |
| 67 | | -both apply, as `-a * b`, they give the same value: an integer's |
| 68 | | -negation and product wrap alike, `-(a * b)` and `(-a) * b` are the |
| 69 | | -same bits, and so are they for reals. The smallest value of a signed |
| 70 | | -type is no exception: it is its own negation. |
| 66 | +The proposal: a factor that follows an operator may be `"-" Factor`. |
| 67 | +The minus at the start of a `SimpleExpr` stays as it is, applying to |
| 68 | +the first term, so no program changes meaning: `-a & b` is still |
| 69 | +`-(a & b)`, which isn't `(-a) & b`, nor is `-a shr n` the same as |
| 70 | +`(-a) shr n`. Only text that is an error today, `x & -8`, gets one. |
| 71 | +The cost is that a minus means two things by where it stands, which |
| 72 | +the report would say in a line. |
| 71 | 73 | |
| 72 | 74 | Met in tery's `aligned`, `(a + 7) & -8`. |
| 73 | 75 | |