From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Harald Hanche-Olsen Newsgroups: gmane.emacs.devel Subject: Re: if-let and when-let: parallel or sequential Date: Mon, 11 Aug 2014 18:40:24 +0200 (CEST) Message-ID: <20140811.184024.462063892661866315.hanche@math.ntnu.no> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: Text/Plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1407775259 10444 80.91.229.3 (11 Aug 2014 16:40:59 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 11 Aug 2014 16:40:59 +0000 (UTC) Cc: john.b.mastro@gmail.com, bozhidar.batsov@gmail.com, emacs-devel@gnu.org To: monnier@iro.umontreal.ca Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Aug 11 18:40:49 2014 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XGseJ-0007BR-6u for ged-emacs-devel@m.gmane.org; Mon, 11 Aug 2014 18:40:43 +0200 Original-Received: from localhost ([::1]:37106 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XGseI-0007JR-IK for ged-emacs-devel@m.gmane.org; Mon, 11 Aug 2014 12:40:42 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44700) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XGse9-0007JM-CK for emacs-devel@gnu.org; Mon, 11 Aug 2014 12:40:38 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XGse4-0003bC-6I for emacs-devel@gnu.org; Mon, 11 Aug 2014 12:40:33 -0400 Original-Received: from hylle05.itea.ntnu.no ([129.241.56.225]:44539) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XGse3-0003b6-V6 for emacs-devel@gnu.org; Mon, 11 Aug 2014 12:40:28 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by hylle05.itea.ntnu.no (Postfix) with ESMTP id 14B3190DFA4; Mon, 11 Aug 2014 18:40:26 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at hylle05.itea.ntnu.no Original-Received: from localhost (unknown [IPv6:2001:700:300:1470:cddb:abf8:14eb:c253]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: hanche) by hylle05.itea.ntnu.no (Postfix) with ESMTPSA id DD26890D5AC; Mon, 11 Aug 2014 18:40:24 +0200 (CEST) In-Reply-To: X-URL: http://www.math.ntnu.no/~hanche/ X-Mailer: Mew version 6.6 on Emacs 24.3.92 / Mule 6.0 (HANACHIRUSATO) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 129.241.56.225 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:173575 Archived-At: [Stefan Monnier (2014-08-11 14:42:19 UTC)] > > if-let and when-let don=E2=80=99t make much sense with more than one = binding > > form. >=20 > Why do you think so? If they only work for a single binding, the > benefit is really minor. It's only when you use several bindings that > the benefit becomes more significant (the alternative being either > a very deeply nested code, or separating the var's declarations from > their initialization). Indeed, it looks useful. But may I point out that the docstring seems deficient? From the source code, I see that the the evaluation short-circuits, so that evaluating (defun foo () (insert "called foo\n") nil) (defun bar () (insert "called bar\n") t) (if-let ((FOO (foo)) (BAR (bar))) (insert "aye\n") (insert (format "nope: %s\n" BAR))) produces called foo nope: nil I can see how that is useful, but it needs to be documented better. I'm afraid the resulting docstring may end up longer than the code, but then so be it. =E2=80=93 Harald