From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andy Wingo Newsgroups: gmane.lisp.guile.devel Subject: when and unless Date: Thu, 30 Jun 2011 12:44:02 +0200 Message-ID: <878vsjd2fh.fsf@pobox.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1309435392 23853 80.91.229.12 (30 Jun 2011 12:03:12 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 30 Jun 2011 12:03:12 +0000 (UTC) To: guile-devel Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Thu Jun 30 14:03:05 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 1QcFxZ-0003rB-8Q for guile-devel@m.gmane.org; Thu, 30 Jun 2011 14:03:05 +0200 Original-Received: from localhost ([::1]:55942 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QcFxU-0006vY-PB for guile-devel@m.gmane.org; Thu, 30 Jun 2011 08:03:00 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:42266) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QcFxI-0006ue-Ix for guile-devel@gnu.org; Thu, 30 Jun 2011 08:02:50 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QcFxG-0007VY-Hn for guile-devel@gnu.org; Thu, 30 Jun 2011 08:02:48 -0400 Original-Received: from a-pb-sasl-sd.pobox.com ([64.74.157.62]:47084 helo=sasl.smtp.pobox.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QcFxG-0007VN-3v for guile-devel@gnu.org; Thu, 30 Jun 2011 08:02:46 -0400 Original-Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-sd.pobox.com (Postfix) with ESMTP id CAEBC5A14 for ; Thu, 30 Jun 2011 08:04:58 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to :subject:date:message-id:mime-version:content-type; s=sasl; bh=r E6ZigqPqKh3z54BSGLFM8NOTBA=; b=b66OZEGuQPOCUbZfI0WHysyrXpkDTg3IA 0mpqA6IFh1263wFHwQEOfb+rGoVhWOh9bDxaVwc2SMDFePpa+7XknsiPhrZGvmpy fyq3jADsEsKtnl7EQxrFsv1Qh1dQ4v/l+8ObsTjd4YSri8V2IFKUXU5JxIek9DM6 I/GHZq8rfM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:subject :date:message-id:mime-version:content-type; q=dns; s=sasl; b=fBg frfx+lxh2IT2+PLSOrjz8yllSy2heB5U1lgv6k501ZaBh02PM238YZNw7wqToig/ Ew3CezPmxyv9IzEHf6kvWfV2DDWfLHdiz2+o3jy4aJgmJeyYBrrwnerlZY4UKQyM QzUNJeruyWtbPXHK41ztW+PcUGNy149AuUa4mrR8= 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 C351B5A13 for ; Thu, 30 Jun 2011 08:04:58 -0400 (EDT) Original-Received: from badger (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 1C5255A11 for ; Thu, 30 Jun 2011 08:04:57 -0400 (EDT) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) X-Pobox-Relay-ID: 2CCEC2B0-A311-11E0-94A7-5875C023C68D-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: 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:12603 Archived-At: I think we should add `when' and `unless' to the default environment. They go like this: (define-syntax when (syntax-rules () ((_ test then then* ...) (if test (begin then then* ... (if #f #f)))))) (define-syntax unless (syntax-rules () ((_ test else else* ...) (if (not test) (begin else else* ... (if #f #f)))))) These are pretty uncontroversial and common, and they make it easier to read code, so let's do it. The only argument I have heard against them is that "when" connotes some connection with time, whereas "if" does not. I agree with this criticism, but "when" is sufficiently common that it shouldn't confuse anyone, and in any case we have modules if someone feels strongly enough to not want these bindings. The trailing (if #f #f) is to indicate that the consequent expressions are evaluated for effect, not for value, and the the return value(s) of `when' and `unless' are not specified. In the future we may cause instances of (if #f #f) used for a value to emit a warning or an error. Regards, Andy -- http://wingolog.org/