[m-rev.] diff: implement trivial branches of rtti_implementation__deconstruct

Fergus Henderson fjh at cs.mu.OZ.AU
Sat Nov 30 00:11:22 AEDT 2002


On 29-Nov-2002, Peter Ross <pro at missioncriticalit.com> wrote:
> 
> library/rtti_implementation.m:
> 	Implement the trivial to implement branches of deconstruct.
> 	Mark all the noncanonical branches to remind me that they need
> 	to be handled specially.
...
> @@ -646,33 +649,38 @@
>  		Arguments = []
>  	;
>  		TypeCtorRep = int,
> -		Functor = "some_int", 
> +		cast_to_type(Term, Int),
> +		Functor = string__int_to_string(Int),
>  		Arity = 0,
>  		Arguments = []
>  	;
>  		TypeCtorRep = char,
> -		Functor = "some_char", 
> +		cast_to_type(Term, Char),
> +		Functor = "'" ++ char_to_string(Char) ++ "'",

There should be an XXX comment here to match the one in
runtime/mercury_ml_expand_body.h:
        /* XXX should escape characters correctly */

Likewise for strings.

> +:- pred cast_to_type(T::in, U::out) is det.
> +
> +cast_to_type(Term, Actual) :-
> +	std_util__type_to_univ(Term, Univ),
> +	std_util__det_univ_to_type(Univ, Actual).

I suggest s/cast_to_type/det_dynamic_cast/g
since cast_to_type is a det version of dynamic_cast in std_util.m.

Otherwise that looks good.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  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