Project

General

Profile

Actions

Bug #7331

closed

Set the precedence of unary `-` equal to the precedence `-`, same for `+`

Added by alexeymuranov (Alexey Muranov) about 12 years ago. Updated over 11 years ago.

Status:
Rejected
Assignee:
-
Target version:
-
ruby -v:
1.9.3
Backport:
[ruby-core:49229]

Description

=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

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0