[mercury-users] Why is --infer-all not the deafult?

David Overton dmo at cs.mu.OZ.AU
Tue Jul 13 21:01:00 AEST 2004


On Tue, Jul 13, 2004 at 11:51:51AM -0700, Maurizio Colucci wrote:
> On Monday 12 July 2004 20:38, Fergus Henderson wrote:
> > But also because we think that writing explicit declarations is good
> > programming practice, since it makes programs easier for a reader
> > to understand.
> 
> Of course you are the boss :-) , however IMHO type declarations make the code 
> heavier to read, while giving little (or no) insight regarding the meaning of 
> the code --- because the meaning of a variable is the way it is used, not its 
> type.

I disagree strongly.  I find that type declarations often provide a very
valuable insight into the meaning of the code.  They help to document
the interface to a function/predicate -- in a program that uses the type
system effectively it is often only necessary to look at the name and
type of a function to work out what it does.  They are checked by the
compiler (unlike most program documentation) and help it to provide more
precise error messages.  In Mercury syntax, declarations stand out
clearly from the rest of the code because they start with `:-'.  They
are usually only 1 or 2 lines long so I don't see how they make the code
significantly "heavier to read" -- certainly not enough to outweigh
their benefits (IMHO).

Cheers,

David
-- 
David Overton
WWW: http://www.overtons.id.au/
Mobile Phone (UK): +44 7799 344 322
--------------------------------------------------------------------------
mercury-users mailing list
post:  mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the users mailing list