On Thu, Dec 08, 2011 at 09:42:36AM +0100, David Kastrup wrote: > So here is another proposal: (values) is not the same as *unspecified*. > But if you take the first value of a values list in single-value > contexts, there is nothing about that coercion mechanism that would keep > you from using *unspecified* whenever that values list would be empty.
That's easy to implement (patch at bottom of post; I tested it). The question for the people on the list to decide is whether it's a good idea. :-) Personally, I don't object to it, but, perhaps others do. Cheers, Chris. * * * diff --git a/libguile/vm-i-system.c b/libguile/vm-i-system.c index 474fe78..6ce5ee3 100644 --- a/libguile/vm-i-system.c +++ b/libguile/vm-i-system.c @@ -1311,7 +1311,7 @@ VM_DEFINE_INSTRUCTION (68, return_values, "return/values", 1, -1, -1) /* Finally null the end of the stack */ NULLSTACK (vals + nvalues - sp); } - else if (nvalues >= 1) + else { /* Multiple values for a single-valued continuation -- here's where I break with guile tradition and try and do something sensible. (Also, @@ -1324,13 +1324,11 @@ VM_DEFINE_INSTRUCTION (68, return_values, "return/values", 1, -1, -1) fp = SCM_FRAME_DYNAMIC_LINK (fp); /* Push first value */ - *++sp = vals[1]; + *++sp = nvalues >= 1 ? vals[1] : SCM_UNSPECIFIED; /* Finally null the end of the stack */ NULLSTACK (vals + nvalues - sp); } - else - goto vm_error_no_values; /* Restore the last program */ program = SCM_FRAME_PROGRAM (fp);