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

Mark Brown mark at cs.mu.OZ.AU
Thu Jul 15 22:57:26 AEST 2004


On 15-Jul-2004, Maurizio Colucci <seguso.forever at tin.it> wrote:
> On Wednesday 14 July 2004 17:16, Peter Schachte wrote:
> > One factor that may lead to this difference of opinion is the
> > abstraction level of the types you are using (or contemplating).  If I
> > declare an argument to be a list of ints, for example, that gives very
> > little insight into what information they carry.  If it's declared to
> > be a set (represented as a sorted list) of timestamps, that gives much
> > more information.
> 
> Yes, but what kind of information?
> 
> Knowing the type of a variable V only tells you what _can_ be done with V. It 
> tells you nothing about what is actually done with V --- that is, the meaning 
> of V.

While the type of a variable doesn't necessarily tell you much about the
intent of the programmer, well chosen identifiers do help.

> 
> For example, knowing that L is a list of timestamps tells me nothing about the 
> meaning of L, that is "the last 10 of times when the user pressed a button".

:- type click_history == list(timestamp).

If "click_history" is a good description of the meaning of L, then using this
equivalent type would definitely help reading as well as writing the code.

Cheers,
Mark.

--------------------------------------------------------------------------
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