Skip to content
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

question: operator style #59

Open
eed3si9n opened this issue Jan 7, 2019 · 3 comments
Open

question: operator style #59

eed3si9n opened this issue Jan 7, 2019 · 3 comments

Comments

@eed3si9n
Copy link

eed3si9n commented Jan 7, 2019

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.

@noelwelsh
Copy link
Contributor

So three issues here:

  1. This is a typo. The former is what I call operator style. I've pushed a fix for this.
  2. Is "operator style" a well known name? Perhaps not. Maybe infix operator is a better term.
  3. Should we even introduce this? cf question: should infix notation be used for non-symbolic method names? #53 Probably should introduce it but perhaps not use infix operators as pervasively as they are currently used.

@eed3si9n
Copy link
Author

eed3si9n commented Jan 7, 2019

  1. ok that makes sense.
  2. 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.
  3. +1. We probably should explain that operators are methods, but not use it so much.

@noelwelsh
Copy link
Contributor

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants