[mercury-users] Proposed change to char literal syntax

Michael Day mikeday at yeslogic.com
Mon Oct 2 15:59:32 AEST 2006


Hi Ralph,

> - make quoted symbols lose any "fixity" (so '+', say, will not be
>   interpreted as an infix symbol).

This sounds like a good idea, as it feels quite strange having to wrap a 
character literal in brackets to stop the fixity of it leaking through 
the single quotes :)

However, if single quotes can still be used in other contexts then it 
seems that the compiler would still need to be able to resolve the 
ambiguity somehow. For example, we have a function like this:

:- func (' ') = unicode.

(' ') = unicode(0x20).

which allows us to use ' ' as a UNICODE character literal if we feel so 
inclined. Which makes me wonder, why not support character literals in a 
similar manner -- as a bunch of functions defined in the char module 
that return an abstract char type -- instead of hard-wiring them into 
the language?

Michael

-- 
Print XML with Prince!
http://www.princexml.com
--------------------------------------------------------------------------
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