Non-ASCII characters in identifier

On a similar note, what is the deal with single quote as an identifier character?

You can do this. The character you want is “modifier letter prime” U+02B9.

@ val a = 1 
a: Int = 1

@ val aʹ = a + 1 
aʹ: Int = 2

If you use a Mac you can add it to your favorites on the Special Chars palette so it’s just a few keystrokes away.

As for non-Roman characters, that’s a problem with your IDE. It’s totally fine with Scala. We have been using this code for years. Similar to what you’re doing, looks like :wink:

3 Likes