[m-dev.] Generating methods for foreign classes

Fergus Henderson fjh at cs.mu.OZ.AU
Thu May 24 02:07:09 AEST 2001


On 23-May-2001, Peter Ross <peter.ross at miscrit.be> wrote:
> The following is a diff which currently generates for the following decl
> 
> :- pragma foreign_class(
>                 'Employee'(employee), % instance used to determine
>                                       % methods implementations
>                 [],                   % List of constructor functions NYI
>                 "Employee"            % Name of exported class
>             ).
> 
> the following IL
> 
> .namespace 'use_person'
> {
>   .class public 'Employee' extends ['Person']'Person'.'Person'
>   {
>     .field private class ['mscorlib']'System'.'Object'[] 'state'
>   }
> }

Hmm, that seems odd; the source decl doesn't mention the word
"person", yet it occurs four times in the generated code.

I think your example is incomplete.  I don't understand it.

Also what happens in grade `il' rather than `ilc'?

> Now if the instance decl is
> 
> :- instance 'Employee'(employee) where [
>     pred('Salary'/3) is salary
> ].
> 
> :- pred salary(int::in, employee::di, employee::uo) is det.
> 
> I now want to generate a .NET method body along the lines of 
> 
> .method void Salary(int s)
> {
>     ldarg s
>     ldarg this_pointer
>     ldfld store
>     ldarg this_pointer
>     ldflda store
>     call mercury_salary_3(int, object[], object[]&)
> }
> 
> Any hints on the best way to do this using the MLDS?

I don't really understand what you're trying to do.
It would help if you could try explaining it a bit more.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "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