[mercury-users] Proposed change to char literal syntax

Ralph Becket rafe at csse.unimelb.edu.au
Mon Oct 2 13:36:40 AEST 2006


The current syntax for char literals has a number of problems and we
would like to gauge user opinion on making a change.

Currently, the syntax for a character literal is to just type the
character as is (e.g., a, b, c), except
- if it's also an operator name (e.g., +, *, /) in which case
  you need to place it in parentheses (e.g., (+), (*), (/))
- or if it's otherwise used in Merury programs (e.g., ', ", space)
  in which case you need to place it in single quotes and possibly
  escape it (e.g., '\'', '"', ' ')
- or if it's a non-printable character, in which case you need to
  quote and use a character escape sequence (e.g., '\n', '\t', '\0234').

We think you'll agree it's something of a mess.  Worse, the type checker
can run out of stack processing erroneous Mercury code containing single
character function symbols (each such symbol doubles the space of
potential type assignments, one being a character, the other being the
function symbol).  This leads to an exponential amount of work which can
cause the compiler to run out of stack space in some cases.

Before we try to fix the situation, we'd like to find out how badly such
a change would affect users.  If we see wailing and gnashing of teeth on
this list from enough users then we will probably abandon the plan...
otherwise it would be good to fix up this syntactic wart.

Ta,
-- Ralph
--------------------------------------------------------------------------
mercury-users mailing list
Post messages to:       mercury-users at csse.unimelb.edu.au
Administrative Queries: owner-mercury-users at csse.unimelb.edu.au
Subscriptions:          mercury-users-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the users mailing list