[m-dev.] multi-language definitions

Tyson Dowd trd at cs.mu.OZ.AU
Sat Feb 23 11:33:45 AEDT 2002


On 22-Feb-2002, Zoltan Somogyi <zs at cs.mu.OZ.AU> wrote:
> On 22-Feb-2002, Tyson Dowd <trd at cs.mu.OZ.AU> wrote:
> > On 22-Feb-2002, Zoltan Somogyi <zs at cs.mu.OZ.AU> wrote:
> > > - If a predicate or function has only foreign_procs, then it must have a
> > >   foreign_only pragma and must not have a foreign_and_mercury pragma.
> > 
> > Do you mean if there are multiple foreign_procs?  Or will you need
> > foreign_only if there is just one foreign_proc?
> 
> Is that a distinction that is important in practice? Surely we should
> encourage people to provide definitions of their predicates that will work
> for all back ends (even if on some back ends, they only call "sorry"),

I think this is only desirable for people modifying the mercury/library
directory or writing general purpose libraries.

If you are writing interfaces to specific foreign language libraries,
this is just going to be annoying, as there is no way you could write
predicates that will work on all backends.

Having this as optional behaviour that we could turn on in the library
directory might be nice, however.

> which means that all predicates that have no Mercury clauses *should*
> have multiple foreign_procs.
> 
> > I'm not particularly keen on having it if there is just one
> > foreign_proc.  
> 
> The error message you would get if you had only one foreign_proc and no
> foreign_only pragma would serve as a reminder that you should add either
> foreign_procs for all the other back ends or a default clause in Mercury.

Which means your code fails to compile every time we add a new backend.

I don't think this useful enough for general use to be worth the pain it
will cause.

-- 
       Tyson Dowd           # 
                            #  Surreal humour isn't everyone's cup of fur.
     trd at cs.mu.oz.au        # 
http://www.cs.mu.oz.au/~trd #
--------------------------------------------------------------------------
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