2

It seems easy to find general info on a specific 'operator' (method, syntactic sugar), but I can't seem to find anything that has a list of all, or even just most, of these goodies. As such, it makes it fairly difficult, or at least overly time consuming, to work through learning the language.

I have already looked over this question. While it has great information, and definitely shows you how to find any information you need, I was hoping for something like a 'pocket ref' that just had all the relevant info and was only dedicated to that.

So, my question is this:

  • Is there a such a list?
  • Am I getting ahead of myself by looking for such a reference early on in learning the language?

Thanks in advance.

Community
  • 1
  • 1
brennebeck
  • 450
  • 4
  • 11

1 Answers1

5

Well, a list of all operators makes as much sense as a list of all methods in the library, regardless of the type. It isn't going to be particularly useful except for finding information about a specific operator.

However, if you do want one, at any ScalaDoc site (http://www.scala-lang.org/api/current/ for the standard library) there is an alphabetic index just under the search bar. The first link (#) lists all the non-alphabetic methods (i.e. "operators").

  1. Many of these are rarely used, or only in specific circumstances.

  2. Obviously, any other library can introduce its own operators, and you'll need to check its own documentation.

Alexey Romanov
  • 167,066
  • 35
  • 309
  • 487
  • When you say many of these are rarely used, why? Just going through the link you provided I see numerous that are used, frequently from what I've seen: `->`, `<=`, etc. Are you saying it's useless because of how they are commonly overloaded pending on context? – brennebeck Feb 12 '14 at 07:46
  • Either way, these seems to be exactly what I was looking for. It links to the relevant definition and explains what it does. Don't know how I missed the non-alpha section of the docs, but thank you very much! – brennebeck Feb 12 '14 at 07:50
  • "When you say many of these are rarely used, why?" Well, Pareto principle applies: most of operator uses are uses of just a few operators (I'd list logical, arithmetical, `++` (and `:+` and `+:`), and `->`). Therefore the remaining operators will be used rarely. E.g. `!?`, `##`, `&+`, ... – Alexey Romanov Feb 12 '14 at 08:31
  • Fair enough. I probably haven't scoured enough Scala code to really evaluate. Thanks for your input. – brennebeck Feb 12 '14 at 08:57