[mercury-users] Proposed change to char literal syntax
Ralph Becket
rafe at csse.unimelb.edu.au
Thu Oct 5 09:56:37 AEST 2006
Nicholas Nethercote, Thursday, 5 October 2006:
> On Mon, 2 Oct 2006, Michael Day wrote:
>
> >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.
>
> That doesn't strike me as a good thing...
I agree. In my experience, I usually start off thinking of using tricks
like this (although nothing as adventurous as this example), but
inevitably end up using longer, more meaningful names, such as
unicode_space. It makes things much less confusing and error prone in
the long run; the extra typing is more than compensated for by the
reduced debugging effort.
-- 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