[m-dev.] for review: document pragma import & nondet pragma c_code

Fergus Henderson fjh at cs.mu.OZ.AU
Thu Nov 5 16:31:54 AEDT 1998


On 05-Nov-1998, Tyson Dowd <trd at cs.mu.OZ.AU> wrote:
> 
> Are typeclass_infos handled at all?

Handled yes, documented no ;-)

> > + at var{FirstCode} will be executed whenever the Mercury procedure is called.
> > + at var{RetryCode} will be executed whenever a given call to the procedure
> > +is re-entered on backtracking to find subsequent solutions.
> > +The shared_code(@var{SharedCode}) argument is optional; if present,
> > + at var{SharedCode} willl be executed after each execution of
> > + at var{FirstCode} or @var{RetryCode}.
> 
> In the first example, the retry_code(RetryCode) arguement is missing.
> Is this optional too?

No, that's a bug in the example.  Fixed.  Thanks.

> > +:- pred foo(int).
> > +:- mode foo(out) is multi.
> > +:- pragma c_code(foo(X::out), [will_not_call_mercury, thread_safe],
> > +        local_vars("
> > +                int state;
> > +        "),
> > +        first_code("
> > +                LOCALS->state = 0;
> > +        "),
> > +        common_code("
> 
> s/common/shared

I've changed the documentation so that it documents `common_code' rather than
`shared_code'.

The compiler actually allows either `shared_code' or `duplicate_code'
as alternatives to `common_code' -- `shared_code' results in smaller
code, `duplicate_code' results in faster but larger code, while with
`common_code' the compiler does its best to make the appropriate
time-space trade-off.  Is it worth documenting this?

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3        |     -- the last words of T. S. Garp.



More information about the developers mailing list