(0000844)
|
mark
|
2015-07-15 12:07
|
|
Mercury has no specific lexical syntax for character literals - they are just terms with arity 0, whose identifiers have length 1.
Single lower case characters are valid identifiers, and so are all operators defined in the operator table. Any other character needs to be enclosed in single-quotes to be a valid identifier, otherwise it won't be treated as a character literal.
Single-character operators in the operator table don't need the quotes, as they are already valid identifiers. However, operators in this table never have arity zero, so they won't be treated as character literals anyway, unless parentheses are used to override the operator table in the usual way. That is the problem in bug.m.
Hence this issue is not a bug, it is intended behaviour. However, it is a common problem for users, and if Mercury had specific syntax for character literals this common problem would be avoided. So perhaps this issue should be considered a feature request for character literal syntax? |
|