[m-dev.] foreign_type pragmas in module interfaces

Julien Fischer juliensf at cs.mu.OZ.AU
Wed Apr 26 17:33:50 AEST 2006


On Wed, 26 Apr 2006, Jonathan Morgan wrote:

> On 4/26/06, Julien Fischer <juliensf at cs.mu.oz.au> wrote:
> > The compiler currently compiles the following without complaint:
> >
> >         :- module ftype_in_interface.
> >         :- interface.
> >
> >         :- type foo.
> >         :- foreign_type("C", foo, "MR_Word").
> >
> > Allowing foreign_type pragmas in module interfaces looks like a bug to me.
>
> I'm inclined to agree.  My first thought was that it would prevent you
> using foreign types from foreign procs outside of the module the
> foreign type was defined in (which could be useful in some
> circumstances).  However, on checking I discovered that the foreign
> procs will be given the correct type for any foreign type, whether it
> has been declared in the interface or not.  Is this likely to be a
> problem in any circumstances?

I wouldn't think so.  foreign_type decls are included in the
implementation section of the .int files anyway.

Julien.
--------------------------------------------------------------------------
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