[m-rev.] for review: add lang spec to pragma import

Peter Ross peter.ross at miscrit.be
Thu Nov 22 21:21:22 AEDT 2001


On Thu, Nov 22, 2001 at 02:18:41PM +1100, Fergus Henderson wrote:
> On 21-Nov-2001, Peter Ross <peter.ross at miscrit.be> wrote:
> > I haven't documented this new syntax yet, as we still accept the old
> > syntax and I want to see how it works on the .NET backend before
> > documenting it in the reference manual.
> 
> New language features should be documented.
> If you don't want to make it part of the official documentation,
> because the feature is not stable,
> then document it and comment the documentation out.
> 
> In general it is best to post the documentation for review before
> bothering with the code.
> 

I would propose the documentation has to change something along these
lines.

@example
:- pragma import(@var{Pred}(@var{Mode1}, @var{Mode2}, @dots{}),
                 @var{Attributes}, @var{ImportedFunction}).
@end example

@var{ImportedFunction} is a term which describes how to call the
specified function on a particular backend.
For instance on the C backend: the term will be @code{c("c_function_name")},
where c_function_name is then name of a C function.

On the IL backend: the term will be something like
@code{il("assembly", "function", yes(return_type), [arg_one_type])},
where return_type and arg_one_type are the mercury type names which are
declared using the foreign_type declaration.


> > Change pragma_import so that it can optionally take a language specifier.
> > If the language specifier is not given we default to c.
> > The new form accepted is
> > 
> >     :- pragma import(p(in, out), c("foo")).
> 
> For consistency with what we do for `pragma foreign_proc',
> `pragma foreign_decl', etc., the language specifier should
> come at the start:
> 
> 	:- pragma import(c, p(in, out)).
> 
Unfortunately the information that we need to include is different for
each backend, so I believe we should place all the information in one
spot and that spot is the location of where you specify the imported
function.

Pete
--------------------------------------------------------------------------
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