Aladdin - Scala Bugtracking
[#389] project: compiler priority: low category: bug
submitter assigned to status date submitted
Philippe Martin fixed 2004-12-13 19:38:05.0
subject Symbol literals should be removed or fixed.
code
object Test {
  def a = 'a;
  def b = 'B;
  def c = '+;
  def d = '`\n`;
}
what happened
tmp/test.scala:4: unclosed character literal
  def c = '+;
          ^
tmp/test.scala:5: unclosed character literal
  def d = '`\n`;
          ^
tmp/test.scala:5: unclosed string literal
  def d = '`\n`;
              ^
three errors found
what expected Currently, chapter 1 and chapter A of the specification do not agree on the lexical syntax. However, if chapter 1 is right then all four symbol literals should be refused because there are no symbol literals at all in chapter 1. And, if chapter A is right, then all four literals should be accepted because chapter A states the following:
symbolLit ::= `\'' id
If chapter A is right then '+ should be a legal symbol literal. However this literal might be a bit surprising. Indeed, '+.name would not return "+" but "$plus".
[back to overview]
Changes of this bug report
Burak  edited on  2005-06-10 18:45:14.0
change to specification bug, and reassign to Stephane ( talk about in a meeting ?). In any case, it's not me who is "responsible" for symbols - once they were important for XML, but since then, they are also used in exercises etc.
Martin  edited on  2006-07-12 12:36:03.0
I fixed as follows:
  plainid        ::=  upper idrest
                   |  varid
                   |  op
  id             ::=  plainid
                   |  `\`' stringLit `\`'
  symbolLiteral  ::=  `'' plainid
So the first 3 cases are OK now, the last one will give an error. I updated the spec accordingly.
Martin  edited on  2006-07-12 12:52:25.0