Practical examples of using symbols in Scala?

Posted by Jesper on Stack Overflow See other posts from Stack Overflow or by Jesper
Published on 2009-08-24T20:08:18Z Indexed on 2010/06/11 8:52 UTC
Read the original article Hit count: 270

Filed under:
|

Scala has symbols - names that start with a single quote ' and which are a kind of string constants.

I know symbols from Ruby (where they start with a colon). In Ruby they are used for some meta-programming tasks, like generating getters and setters for member variables (for example attr_reader :name to generate a getter for name).

I haven't seen a lot of use of symbols in Scala code yet. What are practical uses for symbols in Scala?

© Stack Overflow or respective owner

Related posts about scala

Related posts about symbols