[m-rev.] for review: reserved address data representation (part 1)

Fergus Henderson fjh at cs.mu.OZ.AU
Wed Oct 24 17:07:21 AEST 2001


On 24-Oct-2001, Tyson Dowd <trd at cs.mu.OZ.AU> wrote:
> On 24-Oct-2001, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> > +	% ml_format_reserved_object_name(CtorName, CtorArity, ReservedObjName):
> > +	% Generate a name for a specially reserved global variable
> > +	% (or static member variable)
> > +	% whose address is used to represent the specified constructor.
> > +	%
> > +	% We add the "obj_" prefix to avoid a name clash in the IL back-end
> > +	% between the type for a given constructor
> > +	% and the reserved object for that constructor.
> > +	%
> > +ml_format_reserved_object_name(CtorName, CtorArity) = ReservedObjName :-
> > +	Name = string__format("obj_%s_%d", [s(CtorName), i(CtorArity)]),
> > +	ReservedObjName = var_name(Name, no).
> > +
> 
> It would be better to either
> 	- make prepending "obj_" part of the MLDS - MLDS-suitable for IL
> 	  backend transformation
> 	- make it an invariant of the MLDS that such names don't clash
> 
> Generally we have been trying to solve such problems in the backend
> which has the limitation, so I would prefer the former approach.

On further investigation I discovered that that comment is actually
obsolete already -- originally the prefix was needed for that purpose,
but now I don't generate a type for constructors that are represented
using reserved objects.

I think the "obj_" prefix is still a good idea, just
to avoid any name clashes that might arise in the future,
e.g. name clashes between constructor names and ordinary variable names.

So I'll just change the comment as shown below.

--- ml_code_util.m.old	Wed Oct 24 16:59:58 2001
+++ ml_code_util.m	Wed Oct 24 16:59:59 2001
@@ -1414,9 +1414,7 @@
 	% (or static member variable)
 	% whose address is used to represent the specified constructor.
 	%
-	% We add the "obj_" prefix to avoid a name clash in the IL back-end
-	% between the type for a given constructor
-	% and the reserved object for that constructor.
+	% We add the "obj_" prefix to avoid any potential name clashes.
 	%
 ml_format_reserved_object_name(CtorName, CtorArity) = ReservedObjName :-
 	Name = string__format("obj_%s_%d", [s(CtorName), i(CtorArity)]),

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  | "... it seems to me that 15 years of
The University of Melbourne         | email is plenty for one lifetime."
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- Prof. Donald E. Knuth
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list