[m-dev.] Name mangling (was Re: [m-rev.] For review: Convert Mercury terms to XML)

Fergus Henderson fjh at cs.mu.OZ.AU
Sat Dec 11 06:17:03 AEDT 2004


On 08-Dec-2004, Zoltan Somogyi <zs at cs.mu.OZ.AU> wrote:
> On 07-Dec-2004, Ralph Becket <rafe at cs.mu.OZ.AU> wrote:
> > Can I propose the following scheme:
> > 
> > Unmangled character		Mangled output
> > -------------------		--------------
> > Z				ZZ
> > c in [a-zA-Y0-9_]		c
> > c not in [a-zA-Z0-9]		Z## (where ## is the ASCII hex code for c)
> 
> That won't work very well, but the reason why is best discussed in person.

I would be interested to hear the reason, since I have been using a very
similar name mangling algorithm myself (I use decimal rather than hex,
and have some special cases such as using "ZD" rather than "Z46" for ".",
but otherwise it is the same).

One potential problem is that it does not deal with names that match
keywords, or that start with "__" or start with or contain reserved
patterns.  This I have addressed in my own name mangling algorithm
by using a second pass that checks for those cases.

-- 
Fergus Henderson                    |  "I have always known that the pursuit
                                    |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list