[m-dev.] Tabling [1/3]

Fergus Henderson fjh at cs.mu.OZ.AU
Mon Mar 30 23:47:17 AEST 1998


On 23-Mar-1998, Oliver Hutchison <ohutch at students.cs.mu.oz.au> wrote:
> 
> Index: compiler/instmap.m
> ===================================================================
> RCS file: /home/staff/zs/imp/mercury/compiler/instmap.m,v
> retrieving revision 1.20
> diff -u -r1.20 instmap.m
> --- instmap.m	1998/03/03 17:34:42	1.20
> +++ instmap.m	1998/03/18 05:43:24
> @@ -270,6 +270,8 @@
>  
>  :- import_module std_util, require.
>  
> +:- import_module io.
> +
>  :- type instmap_delta	==	instmap.
>  
>  :- type instmap	--->	reachable(instmapping)
> @@ -766,10 +768,17 @@
>  		ModuleInfo1 = ModuleInfoPrime,
>  		map__det_insert(InstMapping0, Var, Inst, InstMapping1)
>  	;
> +		gio(IO0),
> +		io__print([InstA, InstB], IO0, IO1),
> +		io__nl(IO1, _IO2),
>  		error("merge_instmapping_delta_2: unexpected mode error")
>  	),
>  	merge_instmapping_delta_2(Vars, InstMap, InstMappingA, InstMappingB,
>  		InstMapping1, InstMapping, ModuleInfo1, ModuleInfo).
> +
> +:- pred gio(io__state::uo) is det.
> +
> +:- pragma c_code(gio(I::uo), " I = 0").

Please don't commit this debugging code.

> +proc_check_eval_methods([], _, M, M) --> [].
> +proc_check_eval_methods([ProcId|Rest], PredId, ModuleInfo0, ModuleInfo) --> 
> +	{ module_info_pred_proc_info(ModuleInfo0, PredId, ProcId, 
> +		_, ProcInfo) },
> +	{ proc_info_eval_method(ProcInfo, EvalMethod) },
> +	( { EvalMethod \= eval_normal } ->
> +		{ proc_info_context(ProcInfo, Context) },
> +		{ eval_method_to_string(EvalMethod, EvalMethodS) },
> +		globals__io_lookup_bool_option(verbose_errors, 
> +			VerboseErrors),
> +		{ proc_info_argmodes(ProcInfo, Modes) },
> +		( 
> +			\+ { only_fully_in_out_modes(Modes, 
> +				ModuleInfo0) } 
> +		->
> +			prog_out__write_context(Context),
> +			io__write_string("Error : `pragma "),
> +			io__write_string(EvalMethodS),
> +			io__write_string(
> +"' declaration not allowed for procedure with\n"),
> +			prog_out__write_context(Context),
> +			io__write_string(
> +"  partially instantiated modes.\n"), 

There should be no space before the ":" in the error message.
Also, I think it would be better to say "Sorry, not implemented: "
rather than than "Error: ".

You will need to wrap the line at an earlier point to avoid
overflow.  I suggest that this

a_very_long_filename.m: Error : `pragma minimal_model' declaration not allowed for procedure with
a_very_long_filename.m:   partially instantiated modes.

should become

a_very_long_filename.m: Sorry, not implemented: `pragma minimal_model'
a_very_long_filename.m:   declaration not allowed for procedure with
a_very_long_filename.m:   partially instantiated modes.

> +			prog_out__write_context(Context),
> +			io__write_string("Error : `pragma "),
> +			io__write_string(EvalMethodS),
> +			io__write_string(
> +"' declaration not allowed for procedure with\n"),
> +			prog_out__write_context(Context),
> +			io__write_string(
> +"  unique modes.\n"), 

s/Error :/Error:/

and perhaps wrap the line a little earlier.


Apart from that, all the rest of part 1 looks great!

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3        |     -- the last words of T. S. Garp.



More information about the developers mailing list