creative-scala
creative-scala copied to clipboard
question: operator style
https://www.creativescala.org/creative-scala.html#values-are-objects 2.2.2 Operators says:
1 + 2
// res4: Int = 3
1.+(2)
// res5: Int = 3
This second way of calling a method is known an operator style.
I've never heard of this name before. Is this "operator style" term used somewhere else? I am not sure if I'd associate dot-and-paren style more with "operator" than the infix notation, since operator precedence etc would affect infix notation more.
So three issues here:
- This is a typo. The former is what I call operator style. I've pushed a fix for this.
- Is "operator style" a well known name? Perhaps not. Maybe infix operator is a better term.
- Should we even introduce this? cf #53 Probably should introduce it but perhaps not use infix operators as pervasively as they are currently used.
- ok that makes sense.
- The term I see most is "infix operator notation" ("operator notation" works, but it includes prefix operator notation for
-1), which is also the same term that's written right under it. - +1. We probably should explain that operators are methods, but not use it so much.
👍