[m-rev.] for review: make deconstruct work for herbrand variables

David Jeffery dgj at cs.mu.OZ.AU
Tue Jul 10 18:15:47 AEST 2001


Hi,

For Fergus, Tyson or Zoltan to review:
===================================================================

Estimated hours taken: 1

===================================================================
runtime/mercury_ml_expand_body.h:
	When expanding a value that has MR_SECTAG_VARIABLE as its primary
	tag, do not abort. Instead return "<<variable>>" as its functor,
	and treat the value as being zero-arity.
	This means that deconstruct works for values which are herbrand
	variables, and has the consequence that the debugger does not
	abort if you try to print out a herbrand variable in a HAL program.

	Also fix a typo in a comment.
===================================================================

Index: runtime/mercury_ml_expand_body.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_ml_expand_body.h,v
retrieving revision 1.1
diff -u -t -r1.1 mercury_ml_expand_body.h
--- runtime/mercury_ml_expand_body.h	2001/06/22 03:14:32	1.1
+++ runtime/mercury_ml_expand_body.h	2001/07/10 08:06:51
@@ -172,7 +172,7 @@
 #endif  /* EXPAND_APPLY_LIMIT */
 #ifdef  EXPAND_CHOSEN_ARG
     int chosen,
-#endif  /* CHOSEN_ARG */
+#endif  /* EXPAND_CHOSEN_ARG */
     EXPAND_TYPE_NAME *expand_info)
 {
     MR_TypeCtorInfo type_ctor_info;
@@ -235,8 +235,9 @@
                         arg_vector = (MR_Word *) MR_body(data, ptag) + 1;
                         break;
                     case MR_SECTAG_VARIABLE:
-                        MR_fatal_error(MR_STRINGIFY(EXPAND_FUNCTION_NAME)
-                            ": cannot expand variable");
+                        handle_functor_name("<<variable>>");
+                        handle_zero_arity_args();
+                        return;
                 }
 
                 handle_functor_name(functor_desc->MR_du_functor_name);


dgj
-- 
David Jeffery (dgj at cs.mu.oz.au) | If you want to build a ship, don't drum up 
PhD student,                    | people together to collect wood or assign 
Dept. of Comp. Sci. & Soft. Eng.| them tasks and work, but rather teach them 
The University of Melbourne     | to long for the endless immensity of the sea.
Australia                       | -- Antoine de Saint Exupery
--------------------------------------------------------------------------
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