From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: David Kastrup Newsgroups: gmane.lisp.guile.devel Subject: Re: when and unless Date: Tue, 06 Dec 2011 12:17:06 +0100 Organization: Organization?!? Message-ID: <87mxb6kkzx.fsf@fencepost.gnu.org> References: <878vsjd2fh.fsf@pobox.com> <87r50ircng.fsf@pobox.com> <4EDDC8B1.3000509@gentoo.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1323170252 22152 80.91.229.12 (6 Dec 2011 11:17:32 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 6 Dec 2011 11:17:32 +0000 (UTC) To: guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Tue Dec 06 12:17:28 2011 Return-path: Envelope-to: guile-devel@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 1RXt1c-00039c-0P for guile-devel@m.gmane.org; Tue, 06 Dec 2011 12:17:28 +0100 Original-Received: from localhost ([::1]:45565 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RXt1b-0006P3-5U for guile-devel@m.gmane.org; Tue, 06 Dec 2011 06:17:27 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:35114) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RXt1V-0006OV-E6 for guile-devel@gnu.org; Tue, 06 Dec 2011 06:17:25 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RXt1U-00082L-4S for guile-devel@gnu.org; Tue, 06 Dec 2011 06:17:21 -0500 Original-Received: from lo.gmane.org ([80.91.229.12]:56717) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RXt1T-000828-VV for guile-devel@gnu.org; Tue, 06 Dec 2011 06:17:20 -0500 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1RXt1T-00038F-4q for guile-devel@gnu.org; Tue, 06 Dec 2011 12:17:19 +0100 Original-Received: from p508ed485.dip.t-dialin.net ([80.142.212.133]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 06 Dec 2011 12:17:19 +0100 Original-Received: from dak by p508ed485.dip.t-dialin.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 06 Dec 2011 12:17:19 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 35 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: p508ed485.dip.t-dialin.net X-Face: 2FEFf>]>q>2iw=B6, xrUubRI>pR&Ml9=ao@P@i)L:\urd*t9M~y1^:+Y]'C0~{mAl`oQuAl \!3KEIp?*w`|bL5qr,H)LFO6Q=qx~iH4DN; i"; /yuIsqbLLCh/!U#X[S~(5eZ41to5f%E@'ELIi$t^ Vc\LWP@J5p^rst0+('>Er0=^1{]M9!p?&:\z]|;&=NP3AhB!B_bi^]Pfkw User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.90 (gnu/linux) Cancel-Lock: sha1:AJ4er2c2TwMTNghL30d6vjfDftw= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 80.91.229.12 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:12978 Archived-At: Alex Shinn writes: > On Tue, Dec 6, 2011 at 4:48 PM, Marijn wrote: >> >> Couldn't help but wonder why they don't return the value of the last >> body form, so I looked around a bit and both CLHS[1] and my racket >> REPL seem to agree that they should: >> >> $ racket >> Welcome to Racket v5.2.0.4. >>> (when #t 'hello) >> 'hello >>> (unless #f 'hi) >> 'hi >> >> Is there some other source that suggests that the return value should >> be unspecified? > > Because the result is meaningless when the condition is false. > > CLHS returns nil in this case, but that fits with CL idioms and > not Scheme idioms. when and unless are for side-effects - it's > better to write (and #t 'hello) if you want the result. > > R7RS also leaves it unspecified. I've actually wondered if it would not make sense to return *unspecified* in the case of the plain else-less if even if the condition is true, namely when you write (if #t #t). There is probably code relying on this to be #t, but frankly, this appears like a recipe for breakage. -- David Kastrup