[m-rev.] Add `.' as a module separator.

Simon Taylor stayl at cs.mu.OZ.AU
Tue Dec 3 16:30:17 AEDT 2002


On 03-Dec-2002, Ralph Becket <rafe at cs.mu.OZ.AU> wrote:
> 
> Estimated hours taken: 3
> Branches: main
> 
> Added infix `.' as a module separator.  This is paving the way to phasing
> out `:' as a module separator in order to use it as a synonym for `with_type`
> instead.

You should also change the code to write module qualified terms.
Grep for "\":\"" in the compiler source.
 
> Index: compiler/type_util.m
> ===================================================================
> RCS file: /home/mercury1/repository/mercury/compiler/type_util.m,v
> retrieving revision 1.109
> diff -u -r1.109 type_util.m
> --- compiler/type_util.m	1 Nov 2002 07:06:59 -0000	1.109
> +++ compiler/type_util.m	2 Dec 2002 03:42:37 -0000
> @@ -655,10 +655,13 @@
>  	% include arguments with these types.
>  
>  type_util__is_dummy_argument_type(Type) :-
> -	Type = term__functor(term__atom(":"), [
> +	Type = term__functor(term__atom(FunctorName), [
>  			term__functor(term__atom(ModuleName), [], _),
>  			term__functor(term__atom(TypeName), TypeArgs, _)
>  		], _),
> +	(	FunctorName = "."
> +	;	FunctorName = ":"
> +	),
>  	list__length(TypeArgs, TypeArity),
>  	type_util__is_dummy_argument_type_2(ModuleName, TypeName, TypeArity).

This should use type_to_ctor_and_args rather than explicitly
deconstructing the type itself.

> Index: library/ops.m
> ===================================================================
> RCS file: /home/mercury1/repository/mercury/library/ops.m,v
> retrieving revision 1.40
> diff -u -r1.40 ops.m
> --- library/ops.m	9 Jul 2002 01:30:20 -0000	1.40
> +++ library/ops.m	2 Dec 2002 02:11:06 -0000
> @@ -264,7 +264,7 @@
>  ops__op_table("--->", after, xfy, 1179).	% Mercury extension
>  ops__op_table("-->", after, xfx, 1200).		% standard ISO Prolog
>  ops__op_table("->", after, xfy, 1050).		% standard ISO Prolog
> -ops__op_table(".", after, xfy, 600).		% traditional Prolog (not ISO)
> +ops__op_table(".", after, yfx, 600).		% traditional Prolog (not ISO)

You should change the comment to mention that the associativity is
different to ISO Prolog.

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