[m-rev.] for review: update docs for foreign language interface

Peter Ross pro at missioncriticalit.com
Fri Nov 1 01:03:45 AEDT 2002


On Thu, Oct 31, 2002 at 11:50:59PM +1100, Fergus Henderson wrote:
> Even this may be an overspecification for C#.  The C# code shouldn't
> care if the Mercury argument gets mapped to a C# "ref" parameter, a C#
> "out" parameter, or a C# local variable.  It shouldn't care whether the
> Mercury implementation uses pass-by-reference or copy-in copy-out.
> (For the IL interface, on the other hand, it does matter, since IL
> uses different instructions to reference by-ref parameters than
> local variables.)
> 
Actually the C# code does need to care, as explained by the code below.
The initial value isn't needed for "out x" as any value passed in will
be ignored.  This crops up when calling a mercury predicate which has
been exposed using pragma export.

void g()
{
    int x;
    x = 9; // without the initial value the C# compiler complains.
    f(ref x);
}

void f(ref int y)
{
    y = 7;
}
--------------------------------------------------------------------------
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