[m-dev.] array.m: remove type_to_term and term_to_type

Fergus Henderson fjh at cs.mu.oz.au
Mon Jul 28 13:26:08 AEST 1997


Peter Schachte, you wrote:
> On Sat, 26 Jul 1997, Fergus Henderson wrote:
> 
> > library/array.m:
> > 	Remove definitions for type_to_term and term_to_type for arrays.
> > 	That is now done in term.m.
> 
> Wouldn't it be better to leave behind some comment that these conversions
> are needed, and they are currently implemented in term.m, but that one day
> that code should migrate back to array.m?

Perhaps, but there are a lot of other types (e.g. string, char, int, float,
univ, ...) and a few other operations (e.g. io__write, io__read, ...) for which
this is also the case, so making the comment for just one case wouldn't
be particularly helpful IMHO. 

Here's a full list (I wrote this down a while ago, to make sure that
we had covered all the cases).

TYPES

	int
	character (char)
	float
	string

	pred types
	func types

	void

	unique_array:uniq_array
	std_util:type_info
	std_util:univ
	mercury_builtin:c_pointer
	object:object [proposed]

	io__stream == mercury_builtin:c_pointer
	io__external_state == mercury_builtin:c_pointer

TYPE-DEPENDENT PROCEDURES

	unify		- provided for int, char, float, string,
			  uniq_array, type_info, univ, c_pointer,
			  discriminated union types;
			- aborts for higher-order types, void
			
	compare		- provided for int, char, float, string,
			  uniq_array, type_info, univ, c_pointer,
			  discriminated union types;
			- aborts for higher-order types, void
			
	index		- provided for int, char,
			  discriminated union types;
			- returns -1 for float, string,
			  uniq_array, type_info, univ, c_pointer,
			  higher-order types;
			- aborts for void

	deep_copy	- handles int, char, float, string,
			  uniq_array, type_info, univ, c_pointer,
			  discriminated union types,
			  higher-order types;
			- aborts for void

	deconstruct
	construct

	term_to_type	- handles int, char, float, string,
			  uniq_array, discriminated union types
			- fails (or reports an error) for
			  univ, type_info, c_pointer
			- uses `deconstruct' for remainder

	type_to_term	- handles int, char, float, string,
			  uniq_array, univ, type_info,
			  discriminated union types
			- fails (or reports an error) for c_pointer
			- uses `deconstruct' for remainder

	write 		- handles int, char, float, string,
			  uniq_array, univ, type_info, c_pointer
			- uses `deconstruct' for remainder

	read 		- uses term_to_type

	hash [proposed]


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