[m-dev.] for review: The .NET MSIL backend.

Fergus Henderson fjh at cs.mu.OZ.AU
Thu Oct 12 18:42:46 AEDT 2000


On 12-Oct-2000, Tyson Dowd <trd at cs.mu.OZ.AU> wrote:
> On 06-Oct-2000, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> > > +	% We need to escape all the IDs we output to avoid bumping into
> > > +	% keywords that assembler uses (there are a lot of them, and
> > > +	% there is no list available).
> > > +:- pred escape_id(ilds__id::in, string::out) is det.
> > > +escape_id(Id, EscapedId) :-
> > > +	string__append_list(["'", Id, "'"], EscapedId).
> > 
> > What happens if the Mercury identifier contains a single quote,
> > e.g. for code like
> > 	
> > 	:- func 'why don''t we allow quotes in identifiers' = int.
> > 	'why don''t we allow quotes in identifiers' = 42.
> 
> That gets mangled during code generation.

Oh, I see.  It would help to have a comment here explaining that any
special characters have already been mangled during code generation,
and that this escape_id function therefore only needs to avoid keyword
collisions.  It would also help to have a comment at the
definition of the ilds__id type explaining that ilds__ids cannot
contain special characters (only [a-zA-Z0-9]*).

> We call llds_out__name_mangle
> so it becomes
> 'f_119_104_121_32_100_111_110_39_116_32_119_101_32_97_108_108_111_119_32_113_117_111_116_101_115_32_105_110_32_105_100_101_110_116_105_102_105_101_114_115_95_49_95_102_95_48'
> 
> Obviously this is a usability problem,

I wouldn't worry about too much about that.  Just so long as it works.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3        |     -- 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