Super short one today.
But I think it is necessary to know in case you encounter it in the wild
So yes, super short today like I said.
It is possible in Scala to have weird value name that can be sentences. Or pretty much anything for that matter. You can even try to create a value named
\n and it works.
The syntax is straightforward, just have to start and end the name of the identifier by
It also works for field names in a
case class for instance.
One use case where I have this used pretty often is with giter8. This is a system to create project template. You can learn more on their GitHub. In those template, user can enter any input they want so i can be useful to keep the user input inside the
` so the rest of the template do not break.
Another use case is to be able to use reserved keyword, for instance if you would like to name your value
type that wouldn’t work, but you can name it