bug-guile
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: (+ (values 1 2)) should be 1


From: Hans Aberg
Subject: Re: (+ (values 1 2)) should be 1
Date: Tue, 24 May 2011 15:48:32 +0200

On 24 May 2011, at 15:11, Andy Wingo wrote:

>>>>> But, it is 1 and 2, currently.  (+ FOO) inlines just to FOO, too
>>>>> optimistically.
>>>> 
>>>> It is unspecified according to rsr5.
>>> 
>>> I know.  I'm talking about Guile here.
>> 
>> The Guile manual, sec. 10.2.5.2, says that SCM_UNSPECIFIED is to be used 
>> when the Scheme standard says the return is an unspecified value.
>> 
>> So this Lisp extension breaks off from that. If one wants it, perhaps, there 
>> should be some way to invoke it.
> 
> Hans, you are misreading.  (+ 1) is 1 according to the R5RS.  (+ "foo")
> is an error.  (+ (values 1 2)) is unspecified, as an instance of
> returning an unexpected number of values to a continuation, but it is
> not an instance of the unspecified value.

Andy, I think (values 1 2) should here return SCM_UNSPECIFIED first argument to 
'+', so that people will know that the standard does leave the value 
unspecified.

> When a continuation that expects one value receives more values than it
> is expecting -- e.g., the <> in (+ <>) expects one value -- Guile
> truncates those values to the first one.  If such a continuation
> receives 0 values, Guile signals an error.

So here I think one should enable some kind of Lisp-extension to get that.

There is no guarantee that Guile will not change again unless doing something 
like that. So it is useless for regular programming.

Hans





reply via email to

[Prev in Thread] Current Thread [Next in Thread]