[m-dev.] cvs diff: better doc for higher-order stuff

Tyson Richard DOWD trd at students.cs.mu.oz.au
Tue Apr 22 14:01:29 AEST 1997


> 
> compiler/typecheck.m:
> doc/reference_manual.texi:
> 	Improve the error messages and documentation about trying to
> 	taking the address of builtins and trying to curry higher-order terms.
> 	This change is in response to email from Bart Demoen where Bart
> 	described how he had been confused by the previous error message
> 	and lack of documentation.
> 
> Index: typecheck.m
> ===================================================================
> RCS file: /home/staff/zs/imp/mercury/compiler/typecheck.m,v
> retrieving revision 1.198
> diff -u -r1.198 typecheck.m
> --- typecheck.m	1997/04/21 09:16:08	1.198
> +++ typecheck.m	1997/04/22 02:22:09
> @@ -3513,7 +3513,25 @@
>  		io__write_string(
>  			"  If you're trying to invoke a higher-order\n"),
>  		prog_out__write_context(Context),
> -		io__write_string("  predicate, use `call', not `apply'.\n")
> +		io__write_string("  predicate, use `call', not `apply'.\n"),
> +		prog_out__write_context(Context),
> +		io__write_string(
> +			"  If you're trying to curry a higher-order\n"),
> +		prog_out__write_context(Context),
> +		io__write_string(
> +			"  function, use a forwarding function:\n"),
> +		prog_out__write_context(Context),
> +		io__write_string(
> +			"  e.g. instead of `NewFunc = apply(OldFunc, X)'\n"),
> +		prog_out__write_context(Context),
> +		io__write_string(
> +			"  use `NewFunc = my_apply(OldFunc, X)'\n"),
> +		prog_out__write_context(Context),
> +		io__write_string(
> +		"  where `my_apply' is defined with the appropriate arity,\n"),
> +		prog_out__write_context(Context),
> +		io__write_string(
> +			"  e.g. `my_apply(Func, X, Y) :- apply(Func, X, Y).'\n")
>  	;

Even considered writing some code that will write out a list of 
strings, putting a context at the start of each one? If we are starting
to provide reasonably verbode error message, this might be worth it.

Even as it is, line for line, it would probably shorten the code here.

-- 
       Tyson Dowd           #
                            #             Sign on refrigerator:
     trd at cs.mu.oz.au        #           Refrigerate after opening. 
http://www.cs.mu.oz.au/~trd #                  - C. J. Owen.



More information about the developers mailing list