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: GIT version: values Date: Wed, 26 Jan 2011 21:51:08 +0100 Message-ID: References: <162CAAE3-D2D8-4894-9B9F-3397348DCFA2@telia.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1296074790 19356 80.91.229.12 (26 Jan 2011 20:46:30 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 26 Jan 2011 20:46:30 +0000 (UTC) Cc: bug-guile@gnu.org To: Hans =?utf-8?Q?=C3=85berg?= Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Wed Jan 26 21:46:25 2011 Return-path: Envelope-to: guile-bugs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PiCG0-0007ye-D9 for guile-bugs@m.gmane.org; Wed, 26 Jan 2011 21:46:24 +0100 Original-Received: from localhost ([127.0.0.1]:32822 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PiCFz-0007cI-Vb for guile-bugs@m.gmane.org; Wed, 26 Jan 2011 15:46:24 -0500 Original-Received: from [140.186.70.92] (port=41632 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PiCFt-0007bH-Ho for bug-guile@gnu.org; Wed, 26 Jan 2011 15:46:18 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PiCFq-0005zM-Mf for bug-guile@gnu.org; Wed, 26 Jan 2011 15:46:17 -0500 Original-Received: from a-pb-sasl-sd.pobox.com ([64.74.157.62]:35819 helo=sasl.smtp.pobox.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PiCFq-0005zC-K2 for bug-guile@gnu.org; Wed, 26 Jan 2011 15:46:14 -0500 Original-Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-sd.pobox.com (Postfix) with ESMTP id BE48B352B; Wed, 26 Jan 2011 15:47:02 -0500 (EST) 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:content-transfer-encoding; s=sasl; bh=U8Id5/tbQVna 0RwpLz7t+zy1fLU=; b=ZaHpQJGqCHFT56cwq9PRit5jAhzfCapsS0dPmvxSr5BZ lyGtkoymcS934lDTxI+KQEEAiunwgzx/eKTxwel3TIEBJV5CsWejFPJI2+qoFOyl E3X9MGUg1RJHLkjYqQXdGOlR+gLUlJYglwF4b2kw0bvRe74YyNBXCuzxAMPz2x4= 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:content-transfer-encoding; q=dns; s=sasl; b=on4oNN gEC1DKeqfEr7a0+u8cf5Ue6eZPRQw1xxDYNCJdEttC+Jk8Bt8YQnUXvIRscPC72k JFteKAKbxXVlD1XgK2eEApfJOalwZ4nFPD8ezSFaFyEGSra8jyzQEXPZS0g5SYWx KChr6ODjBXz5XyQXSHyGKV5+VRexnkbRZmIXA= 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 A5955352A; Wed, 26 Jan 2011 15:47:01 -0500 (EST) 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 C55393529; Wed, 26 Jan 2011 15:46:59 -0500 (EST) In-Reply-To: <162CAAE3-D2D8-4894-9B9F-3397348DCFA2@telia.com> ("Hans =?utf-8?Q?=C3=85berg=22's?= message of "Wed, 19 Jan 2011 15:44:24 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) X-Pobox-Relay-ID: 6CF5A6FE-298D-11E0-B2F7-BC4EF3E828EC-02397024!a-pb-sasl-sd.pobox.com X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) X-BeenThere: bug-guile@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Errors-To: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.bugs:5034 Archived-At: Hi Hans, Thanks for porting to the 1.9 development series! On Wed 19 Jan 2011 15:44, Hans =C3=85berg writes: > It seems it is not only 'values' writing, but the new behavior seems to > be to strip trailing values quietly: > (define a (values 2 3 4)) > (call-with-values (lambda () a) (lambda x x)) > in Guile 1.9.14.68-a7d8a computes to > $1 =3D (2) > > By contrast, in guile-1.8.8, it computes to > (2 3 4) Indeed. This and a (hopefully small) number of other differences are noted in the NEWS. In this case: ** 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. ** Multiple values in compiled code are not represented by compound objects This change may manifest itself in the following situation: (let ((val (foo))) (do-something) val) In the interpreter, if `foo' returns multiple values, multiple values are produced from the `let' expression. In the compiler, those values are truncated to the first value, and that first value is returned. In the compiler, if `foo' returns no values, an error will be raised, while the interpreter would proceed. Both of these behaviors are allowed by R5RS and R6RS. The compiler's behavior is more correct, however. If you wish to preserve a potentially multiply-valued return, you will need to set up a multiple-value continuation, using `call-with-values'. There is no tuple with multiple-valued returns: they are returned on the stack. Regards, Andy --=20 http://wingolog.org/