8000 SIP-NN - Match infix & prefix types to meet expression rules by soronpo · Pull Request #674 · scala/docs.scala-lang · GitHub
[go: up one dir, main page]

Skip to content

SIP-NN - Match infix & prefix types to meet expression rules #674

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Feb 13, 2017
Prev Previous commit
Next Next commit
More updates from feedback
- Changed title to reflect more what's inside the SIP.
- Visual modifications
  • Loading branch information
soronpo authored Feb 10, 2017
commit 84d5cc5564708395215df3f7b8f07bd7f0e328df
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
layout: sip
disqus: true
title: SIP-NN - Make types behave like expressions
title: SIP-NN - Match infix & prefix types to meet expression rules
---

**By: Oron Port**
Expand All @@ -12,6 +12,7 @@ title: SIP-NN - Make types behave like expressions
|---------------|--------------------------|
| Feb 7th 2017 | Initial Draft |
| Feb 9th 2017 | Updates from feedback |
| Feb 10th 2017 | Updates from feedback |

Your feedback is welcome! If you're interested in discussing this proposal, head over to [this](https://contributors.scala-lang.org/t/sip-nn-make-infix-type-alias-precedence-like-expression-operator-precedence/471) Scala Contributors thread and let me know what you think.

Expand All @@ -20,7 +21,7 @@ Your feedback is welcome! If you're interested in discussing this proposal, head
Currently scala allows symbol operators (`-`, `*`, `~~>`, etc.) for both type names and definition names.
Unfortunately, there is a 'surprise' element since the two differ in behaviour:

* **Infix operator precedence and associativity**:
###Infix operator precedence and associativity
Infix types are 'mostly' left-associative,
while the expression operation precedence is determined by the operator's first character (e.g., `/` is precedent to `+`).
Please see [Infix Types](http://scala-lang.org/files/archive/spec/2.12/03-types.html#infix-types) and [Infix Operations](http://scala-lang.org/files/archive/spec/2.12/06-expressions.html#infix-operations) sections of the Scala specifications for more details.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you roughly explain what the current rules for infix operations are? A little bit of context will help the reader understand what you're proposing.

Copy link
Contributor Author
@soronpo soronpo Feb 9, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. Gave a short description and provided an example. I can also place a screenshot of the entire section.

Expand Down Expand Up @@ -55,7 +56,8 @@ object InfixTypePrecedence {
}
```

* **Prefix operators bracketless unary use**: While expressions have prefix unary operators, there are none for types. See the [Prefix Operations](http://scala-lang.org/files/archive/spec/2.12/06-expressions.html#prefix-operations) section of the Scala specification.
###Prefix operators bracketless unary use
While expressions have prefix unary operators, there are none for types. See the [Prefix Operations](http://scala-lang.org/files/archive/spec/2.12/06-expressions.html#prefix-operations) section of the Scala specification.
This is a lacking feature of the type language Scala offers. See also interactions of this feature with other Scala features, further down this text.


Expand Down
0