| ... | ... | @@ -33,11 +33,19 @@ |
|
|
|
Resolve more prefix minus application unambiguously by:
|
|
|
|
|
|
|
|
|
|
|
|
1. Considering only operators to the right of prefix negation.
|
|
|
|
1. Considering only operators to the right of prefix negation (as currently done only by Hugs)
|
|
|
|
|
|
|
|
1. Leave prefix minus bind less tight than multiplication.
|
|
|
|
1. Leave prefix minus bind less tight than multiplication (as is currently done)
|
|
|
|
|
|
|
|
1. one of the following alternative formulations (the essence of this propoasl)
|
|
|
|
|
|
|
|
- Do not consider associativity of prefix minus
|
|
|
|
- Let prefix minus bind a bit stronger than infix minus
|
|
|
|
- Resolve *all* prefix minus applications (prior to infix resolution)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1. Do not consider associativity of prefix minus or (alternative formulation) let prefix minus bind a bit stronger than infix minus.
|
|
|
|
|
|
|
|
|
|
|
|
Pro:
|
| ... | ... | @@ -162,7 +170,7 @@ replace: |
|
|
|
|
|
|
|
with:
|
|
|
|
"The handling of the prefix negation operator, -, complicates matters only slightly. (Recall that) prefix negation has lower precedence than infix multiplication. So -a \* b resolves as -(a \* b) or more importantly `-a ^ b` as `-(a ^ b)`. Generally, prefix negation extends as long to the right as there are consecutive infix operators with precedences at least as high as multiplication.
|
|
|
|
The operator to the left of prefix -, if there is one, is ignored. So a + -b or a \* -b are legal. Prefix negation binds tighter with infix operators to the right of lower precedence than multiplication. So for example -a + b is legal and resolves as (-a) + b."
|
|
|
|
The operator to the left of prefix -, if there is one, is irrelevant for resolution. So a + -b or a \* -b are legal. Prefix negation binds tighter with infix operators to the right of lower precedence than multiplication. So for example -a + b is legal and resolves as (-a) + b."
|
|
|
|
|
|
|
|
|
|
|
|
|
| ... | ... | |