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

Tyson Dowd trd at cs.mu.OZ.AU
Thu Nov 5 16:35:07 AEDT 1998


On 05-Nov-1998, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> 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?

Maybe.  I didn't know about it.  Sounds like creeping featuritis to me.

-- 

Because I dislike being quoted I lie almost constantly when talking 
about my work.
		-- Terry Gilliam

Tyson Dowd   <tyson at tyse.net>   http://tyse.net/tyson 




More information about the developers mailing list