[mercury-users] An ugliness in the language (char literals)

Peter Schachte schachte at cs.mu.OZ.AU
Wed Aug 2 13:04:00 AEST 2000


On Tue, Aug 01, 2000 at 08:11:08AM -0700, Ralph Becket wrote:
> If I want to write down a char literal, the only consistent syntax
> for doing so is ('x').  This strikes me as a bit grotty.  The problem
> arises in that
> (1) some characters, e.g. `_', have to be escaped in quotes to avoid
> being interpreted as non-chars, and
> (2) some characters, e.g. `+', have to be bracketed otherwise the
> parser expects them to be part of an, in this case infix, expression.
> 
> Ugh.  Ain't Prolog syntax ugly at times?

Yes it is, but this isn't one of those times.  Prolog doesn't have a character
type, it just uses integers.  And prolog's syntax for character constants is
0'c, which uses Prolog's general radix notation with a radix of 0.  As ugly as
that may be, it doesn't cause any problems with operators or need any
escaping.

-- 
Peter Schachte <schachte at cs.mu.OZ.AU>  Abstraction is the only mental tool
http://www.cs.mu.oz.au/~schachte/      by means of which a very finite piece
Phone:  +61 3 8344 9166                of reasoning can covera myriad of
Fax:    +61 3 9348 1184                cases. -- Edsgar Dijkstra 
--------------------------------------------------------------------------
mercury-users mailing list
post:  mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the users mailing list