From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andy Wingo Newsgroups: gmane.lisp.guile.bugs Subject: Re: (+ (values 1 2)) should be 1 Date: Tue, 24 May 2011 17:07:26 +0200 Message-ID: References: <6B109ACE-F9E4-463D-8314-A19CC40D5B50@telia.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1306249689 14966 80.91.229.12 (24 May 2011 15:08:09 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 24 May 2011 15:08:09 +0000 (UTC) Cc: bug-guile To: Hans Aberg Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Tue May 24 17:08:05 2011 Return-path: Envelope-to: guile-bugs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QOtDH-00083y-W9 for guile-bugs@m.gmane.org; Tue, 24 May 2011 17:08:04 +0200 Original-Received: from localhost ([::1]:41049 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QOtDH-0005hZ-Bp for guile-bugs@m.gmane.org; Tue, 24 May 2011 11:08:03 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:58903) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QOtDE-0005hP-0R for bug-guile@gnu.org; Tue, 24 May 2011 11:08:01 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QOtDC-0003io-PU for bug-guile@gnu.org; Tue, 24 May 2011 11:07:59 -0400 Original-Received: from a-pb-sasl-sd.pobox.com ([64.74.157.62]:37235 helo=sasl.smtp.pobox.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QOtDC-0003d3-Mm for bug-guile@gnu.org; Tue, 24 May 2011 11:07:58 -0400 Original-Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-sd.pobox.com (Postfix) with ESMTP id B2DCC4CD2; Tue, 24 May 2011 11:09:41 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=sasl; bh=7vuGEVwR611BbSn8Lh+k+S/CXG4=; b=ddrfTL 4+uuwe6rC6CHrCHWiXe0oc7yJUQutgd2mfimnTofec5YLyOi3s0QXjrhIjaZg4ra Vw/UDQhtHQH23KvSEVLlgL+WzaTiy7HQ2dUcBOI5ss/9IdpvfOKgynoMOeLoapbx uofcKg9TTAKlxhBjZMatmcdIpkxZYgtYXfsRU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; q=dns; s=sasl; b=P4u3yaaeoW6vuQGwU2VrunFOIZq+6VrV XHp6WAKYepDA/Jf5pMhUp6vLrF/PzH9U3KMu4WiW/F5kymmSQmXnQNnNxCso1g46 D33mE9DacED5LOs2Eqsrp89QYr7fASe0mgh6SaXH9k5C066KT0xMX/+CxR7Qo/tE TLNHf1dd0hE= Original-Received: from a-pb-sasl-sd.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-sd.pobox.com (Postfix) with ESMTP id 8C4D54CCF; Tue, 24 May 2011 11:09:40 -0400 (EDT) Original-Received: from unquote.localdomain (unknown [90.164.198.39]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by a-pb-sasl-sd.pobox.com (Postfix) with ESMTPSA id AE3E84CCD; Tue, 24 May 2011 11:09:38 -0400 (EDT) In-Reply-To: <6B109ACE-F9E4-463D-8314-A19CC40D5B50@telia.com> (Hans Aberg's message of "Tue, 24 May 2011 15:48:32 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) X-Pobox-Relay-ID: D90BFFAA-8617-11E0-BF35-D6B6226F3D4C-02397024!a-pb-sasl-sd.pobox.com X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) X-Received-From: 64.74.157.62 X-BeenThere: bug-guile@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Original-Sender: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.bugs:5614 Archived-At: On Tue 24 May 2011 15:48, Hans Aberg writes: > On 24 May 2011, at 15:11, Andy Wingo wrote: > >>> 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. That is not what the standard says. It says that the effect of returning an unexpected number of values is unspecified, not that the *value* is unspecified -- which wouldn't make sense anyway, as they are multiple values in the first place. See the R5RS, the R6RS, and the NEWS please. ** Returning multiple values to compiled code will silently truncate the values to the expected number For example, the interpreter would raise an error evaluating the form, `(+ (values 1 2) (values 3 4))', because it would see the operands as being two compound "values" objects, to which `+' does not apply. The compiler, on the other hand, receives multiple values on the stack, not as a compound object. Given that it must check the number of values anyway, if too many values are provided for a continuation, it chooses to truncate those values, effectively evaluating `(+ 1 3)' instead. The idea is that the semantics that the compiler implements is more intuitive, and the use of the interpreter will fade out with time. This behavior is allowed both by the R5RS and the R6RS. Andy -- http://wingolog.org/