[m-dev.] Update library pragma C code

Peter Schachte pets at students.cs.mu.OZ.AU
Mon Aug 3 13:09:48 AEST 1998


On Mon, 3 Aug 1998, Thomas Charles CONWAY wrote:

> For safety, the default should be may_call_mercury and not_thread_safe
> and may_trail, since if the code may call mercury, may not be thread safe
> or may use the trail and the default is the opposite, your code may crash,
> but code making the conservative assumption will not.

That's precisely the reasoning I was questioning on the grounds of human
nature.  People like to think as little as possible; they'll tend to
cut-and-past to construct their pragmas.  The longer the list of keywords
that *usually* appear, the less likely they'll notice that one of them
doesn't belong and should be removed.

People won't leave the list of flags empty, and then add flags carefully
later to improve efficiency.  They'll tend to work in the negative space,
assuming they should put all the keywords in, for maximum efficiency, and
then go back and remove the ones that don't belong when they think of it (or
when a core dump reminds them).  And the reader will be a less likely to
notice that one keyword out of 5 or 10 isn't there when the others are, than
to notice that a keyword is there, when not many are. 

In the end, people are going to get it wrong sometimes unless you find a way
to automatically detect when they've gotten it wrong. I don't think you make
it any less likely by making people list a bunch of keywords on every pragma
in order to get maximimum efficiency (which they will want) than by making
them identify the (few) places where there could be a problem.


-Peter Schachte               | Life is what happens to you when you're
mailto:pets at cs.mu.OZ.AU       | making other plans.
http://www.cs.mu.oz.au/~pets/ |     -- Betty Talmadge 
PGP: finger pets at 128.250.37.3 | 




More information about the developers mailing list