```Issue #7331 has been updated by alexeymuranov (Alexey Muranov).

stomar (Marcus Stollsteimer) wrote:

> 1. Changing the precedence of `**' and unary `-' would affect the results and is in discrepancy with mathematical rules.

There are already discrepancies with mathematical rules, like allowing `2 * -3`.

> 2. Changing the precedence of `*' and unary `-' would not affect the results and would not have any benefits.

My request was about changing parsing, i agree that for integers it would not affect the result.  The benefit would be to eliminate a discrepancy with mathematical parsing rules.  In mathematics, `(-1) * 2 * 3 = (- 2) * 3 = - (2 * 3)` because it is a property of integers, but `- 2 * 3` is a shorthand syntax for `- (2 * 3)`.

> 3. The current parsing is **NOT** wrong, since -a = (-1) * a, so - a * b = (-1) * a * b, and you have essentially the same precedence, so the "natural" way is to go from left to right.

You are talking about the result (for integers), not about parsing.  How is the current parsing not mathematically wrong if `- 2 * 3` is parsed as `(- 2) * 3`?  (I repeat, i am talking about parsing.)
----------------------------------------
Bug #7331: Set the precedence of unary `-` equal to the precedence `-`, same for `+`
https://bugs.ruby-lang.org/issues/7331#change-33626

Author: alexeymuranov (Alexey Muranov)
Status: Rejected
Priority: Normal
Assignee:
Category: core
Target version:
ruby -v: 1.9.3

=begin
I will not be surprised if this proposal is rejected, because the compatibility would be a mess, but i feel i need to start a discussion.  This continues the discussion in #7328.

To the best of my knowledge, in mathematics the unary minus has the same precedence as the binary one.  However, in the expression

- a * b

Ruby computes first (({-a})), and then the product.  This means that if i want (for whatever reason) to compute the expression in the natural order, i have to put the parentheses:

- (a * b)

which looks very strange to me.  I would consider this a bug.
=end

--
http://bugs.ruby-lang.org/

```