[m-rev.] diff: Fix a problem with semaphores in the IL backend

Jonathan Morgan jonmmorgan at gmail.com
Thu Jun 14 17:09:45 AEST 2007


On 6/14/07, Julien Fischer <juliensf at csse.unimelb.edu.au> wrote:
>
> On Wed, 13 Jun 2007, Peter Ross wrote:
>
> > On 6/13/07, Julien Fischer <juliensf at csse.unimelb.edu.au> wrote:
> >> Is there a distinction between foreign_decl and foreign_code pragmas
> >> for C#?
> >>
> > There should not be.
>
> Jon, why have you moved the declaration of the ML_semaphore class from
> a foreign_decl pragma to a foreign_code one then?

>From the reference manual:
The C# code from pragma foreign_proc declarations for C# will be
placed in the bodies of static member functions of an
automatically-generated C# class. [this is from the foreign_code
section, though I notice it refers to foreign_proc]

pragma foreign_decl declarations for C# can be used to provide any
top-level C# declarations (e.g. using declarations or auxiliary class
definitions) which are needed by C# code in pragma foreign_proc
declarations in that module.

Basically, a foreign_decl will be at the top-level of the file, and is
typically used for using statements and similar, though it can be used
for classes.  The foreign_code will be inside the automatically
generated class, and so a class declared there will be an inner class.
 Since the class is being defined for the use of the mercury_code
class, I prefer it to be an inner class.  I also prefer it to be
inside a namespace, rather than being left outside of the namespace as
it was.  That's why I changed it.  If it had been a foreign_code
declaration then the type would be something like "[mercury]
ML_Semaphore".

Jon
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list