[m-rev.] for review: improve MC++ support

Peter Ross pro at missioncriticalit.com
Tue May 28 01:02:35 AEST 2002


On Sat, May 25, 2002 at 10:59:47AM +1000, Tyson Dowd wrote:
> > library/construct.m:
> > library/exception.m:
> > library/io.m:
> > library/rtti_implementation.m:
> > library/std_util.m:
> >     Changes required to get the library to be able compile in the ilc
> >     grade.  These consist of
> >         - getting rid of references to anonymous variables
> >         - giving variables which are passed by reference an initial value
> >         - adding a missing ; in std_util.
> 
> Is this only required for ILC grade or is this related to the change for
> MC++?  The changes are fine but I want to know whether they are related
> or not.
> 
They are related to this change.

> If you have to give initial values for Mercury output variables then
> this needs a small amount of documentation.
> 
It is not for all output variables, it is only for conditions like that
follows.

:- pragma foreign_proc("C#", f(X::out), "
    func(ref X);
").

We used to generate the following C# code

f_1(ref int X)
{
    func(ref X);
}

now we generate this

f_1(ref int X_1)
{
    f(ref X);
    X_1 = X;
}

so the C# compiler complains about X not having an intial value.  This
could have been solved if we declared func to be func(out int x)
instead.

Do you still think that this should be documented somewhere? If so
where?


> > Index: compiler/mlds_to_il.m
> > ===================================================================
> > RCS file: /home/mercury1/repository/mercury/compiler/mlds_to_il.m,v
> > retrieving revision 1.114
> > diff -u -r1.114 mlds_to_il.m
> > --- compiler/mlds_to_il.m	7 May 2002 11:03:07 -0000	1.114
> > +++ compiler/mlds_to_il.m	20 May 2002 14:17:47 -0000
> > @@ -1912,7 +1912,9 @@
> >  		; RetType = simple_type(bool) ->
> >  			StoreReturnInstr = instr_node(stloc(name("succeeded")))
> >  		;
> > -			sorry(this_file, "functions in MC++")
> > +			StoreReturnInstr = empty
> >  		},
> >  		MethodName =^ method_name,
> >  		{ assoc_list__keys(Params, TypeParams) },
> 
> If we are using the same system as for C# this code should not even get
> called for MC++.  It should generate an error message instead (like the
> other cases for inline_target_code in the IL backend).
> 
Done.

> > Index: compiler/mlds_to_managed.m
> > ===================================================================
> > +
> > +:- inst managed_lang == bound(csharp; managed_cplusplus).
> 
> Might be easier to define a mode for in(managed_lang) too.
> 
The mode name will probably end up being in_managed_lang so I don't
think it buys us anything.
--------------------------------------------------------------------------
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