Linked Questions
10 questions linked to/from Valid identifier characters in Scala
441 votes
12 answers
140k views
What do all of Scala's symbolic operators mean?
Scala syntax has a lot of symbols. Since these kinds of names are difficult to find using search engines, a comprehensive list of them would be helpful. What are all of the symbols in Scala, and what ...
20 votes
2 answers
17k views
What does a "?" symbol (question mark) mean in Scala?
I meet some scala code with "?" but do not know what it mean in scala, could anyone explain it to me ? Thanks. And here's one example def getJobId(conf: Configuration): String = ?(conf.get("...
4 votes
5 answers
3k views
Scala a better println
I often find myself doing things like: println(foo) when I'd like to do: println foo The compiler does not allow this. Also, println is a mouthful, I really just want to say: echo foo So, in a ...
5 votes
2 answers
9k views
Why are special characters not allowed in variable names?
Why are special characters (except underscore) not allowed in variable names of programming languages? Is there a reason related to computer architecture or organisation?
3 votes
2 answers
5k views
Scala custom operator (example abs)
I know that scala allows overloading for it's default operators (+, - ! etc.) . Is it possible to define custom operators and make something like the |.| operator so that | -3| that evaluates to 3. Or ...
2 votes
3 answers
726 views
Scala: Option[T] as ?[T] (or even T?)
i tried type ?[_] = Option[_] def f(x: ?[Int]) = for (y <- x) yield y (but i don't know what i am doing.) insofar as types are just objects, i should be able to define a postix operator (i.e. ...
6 votes
2 answers
2k views
Scala method and values names
Why this fails to compile: scala> val a? = true <console>:1: error: illegal start of simple pattern val a? = true ^ and this works? scala> val a_? = true a_?: Boolean = ...
0 votes
1 answer
359 views
Unable to use Euro currency symbol (€) as method name
I want to write some code for currency stuff, so I try to use € for some nice postfix notation. But I get this compiler error Error:(46, 9) illegal character '\u20ac' def € = EUR ^ Am I doing ...
0 votes
1 answer
249 views
Asterisk in val name using Scala
Just saw an example that looks like the following: val b_* = grater[Book].asObject(dbo) What is the significance of the asterisk in b_* here? What's the name for it in Scala and what affect does it ...
1 vote
2 answers
82 views
Scala "belongsTo" function
I am often in the situation of doing this type of filtering: allPeople .filter(person => englishPeopleIds contains person.id) and it would make my life easier and my code more readable if there ...