[m-rev.] for review: functional dependencies (1/3)

Fergus Henderson fjh at cs.mu.OZ.AU
Wed Apr 20 20:19:54 AEST 2005


On 20-Apr-2005, Mark Anthony BROWN <mark at cs.mu.OZ.AU> wrote:
> Implement functional dependencies for the typeclass system.

That is a huge piece of work you've done there.  Great job!

> +++ NEWS	19 Apr 2005 14:32:41 -0000
> @@ -1,6 +1,10 @@
>  NEWS since the 0.12.0 fork:
>  ----------------------------------
>  
> +Changes to the Mercury language:
> +* We have added support for functional dependencies to the typeclass system.

It would be a good idea to add a pointer there to the appropriate
section of the language reference manual which documents the new feature.

> +	% In the HLDS, functional dependencies are represented using
> +	% argument positions (counting from 1) rather than type variables.
> +	% We know that there will be a one-one correspondence since
> +	% typeclass parameters must be distinct variables, and using
> +	% argument positions is more efficient.
> +	%
> +:- type hlds_class_fundeps == list(hlds_class_fundep).
> +:- type hlds_class_fundep
> +	--->	fundep(
> +			domain		:: set(int),
> +			range		:: set(int)
> +		).

You might want to consider using

	:- type hlds_class_argpos == int.

to further document in the code what is already documented in the comment.
It's not especially helpful here, but maybe there are other places in
the code that use 'int' which could instead use this type synonym and
hence be hyperlinked (via vim/emacs tags) to the definition of this type
synonym and hence to the comment above.

-- 
Fergus Henderson                    |  "I have always known that the pursuit
                                    |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list