[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: when and unless
From: |
Chris K. Jester-Young |
Subject: |
Re: when and unless |
Date: |
Thu, 8 Dec 2011 10:34:17 -0500 |
User-agent: |
Mutt/1.5.20 (2009-06-14) |
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);
- Re: when and unless, (continued)
- Re: when and unless, Alex Shinn, 2011/12/06
- Re: when and unless, David Kastrup, 2011/12/06
- Re: when and unless, Andy Wingo, 2011/12/06
- Re: when and unless, David Kastrup, 2011/12/06
- Re: when and unless, Andy Wingo, 2011/12/06
- Re: when and unless, David Kastrup, 2011/12/06
- Re: when and unless, Chris K. Jester-Young, 2011/12/06
- Re: when and unless, David Kastrup, 2011/12/07
- Re: when and unless, Chris K. Jester-Young, 2011/12/07
- Re: when and unless, David Kastrup, 2011/12/08
- Re: when and unless,
Chris K. Jester-Young <=
- Re: when and unless, David Kastrup, 2011/12/08
- Re: when and unless, Ian Price, 2011/12/08
- Re: when and unless, Chris K. Jester-Young, 2011/12/07
Re: when and unless, Chris K. Jester-Young, 2011/12/06
Re: when and unless, Ludovic Courtès, 2011/12/06