raz / commit fde43f53

commit
fde43f53f8d0d198b5c98c255cb3c16282ac4a61
author
Luis <42945842+ldiaz94@users.noreply.github.com>
date
parent
dbff4176
PROPOSALS: a minus after an operator, keeping the leading one as it is

A minus binding to its factor everywhere would change -a & b and
-a shr n; only one after an operator is proposed.

patch · log

1 file changed, +7 -5

PROPOSALS.md modified +7 -5

@@ -63,11 +63,13 @@
6363 but nearly every other language takes it, and the error ("expected an
6464 expression, found -") surprises.
6565
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.
7173
7274 Met in tery's `aligned`, `(a + 7) & -8`.
7375