From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Emanuel Berg Newsgroups: gmane.emacs.help Subject: Re: if vs. when vs. and: style question Date: Wed, 25 Mar 2015 01:21:32 +0100 Organization: Aioe.org NNTP Server Message-ID: <87vbhq53lf.fsf@debian.uxu> References: <87sicvwckx.fsf@wmi.amu.edu.pl> <87wq27yvqg.fsf@debian.uxu> <8d531e99-7260-4263-ac99-09c6871e2708@googlegroups.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1427242828 31416 80.91.229.3 (25 Mar 2015 00:20:28 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 25 Mar 2015 00:20:28 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Mar 25 01:20:23 2015 Return-path: Envelope-to: geh-help-gnu-emacs@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 1YaZ3T-0003Kw-P3 for geh-help-gnu-emacs@m.gmane.org; Wed, 25 Mar 2015 01:20:19 +0100 Original-Received: from localhost ([::1]:35216 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YaZ3S-0003xw-Vq for geh-help-gnu-emacs@m.gmane.org; Tue, 24 Mar 2015 20:20:18 -0400 Original-Path: usenet.stanford.edu!news.kjsl.com!feeder.erje.net!eu.feeder.erje.net!newsfeed.datemas.de!weretis.net!feeder4.news.weretis.net!news.mixmin.net!aioe.org!.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 58 Original-NNTP-Posting-Host: feB02bRejf23rfBm51Mt7Q.user.speranza.aioe.org Original-X-Complaints-To: abuse@aioe.org User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) X-Notice: Filtered by postfilter v. 0.8.2 Cancel-Lock: sha1:8oF2WPAyoJfkWk3DuxCb2UUfx+c= Mail-Copies-To: never Original-Xref: usenet.stanford.edu gnu.emacs.help:211017 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:103298 Archived-At: Rusi writes: > In general weaker is better > http://www.w3.org/2001/tag/doc/leastPower.html > > (when a b) ... (if a b) However (if a b c) ... (when ??) What do you mean by "weaker"? `if' can do three arguments, on the other hand it needs a `progn' to do several forms. `when' comes with implicit progn but cannot do the three way if-else if-else branch. What I can see `if' is more flexible and you can change things without having to change the outermost `if', which is practical. Yes, with the use of `not' and `progn' if necessary, but I don't see a problem with that. > Other example: > > destructuring-bind is strictly weaker than if/cond > and so better when usable What is "destructuring-bind"? What do you mean by "strictly weaker"? ("Strictly less" is (a < b) as opposed to (a <= b) which is "less than or equal".) If what you mean by "weaker" is some attempt at a formalization of "you can do less" then I do not agree that should be preferred by definition. For example, here (1+ 5) ; 6 (+ 1 5) ; 6 I'm sure (1+ 5) looks better to some, but think it is even steven. It depends. The (+ ... ) construct is very familiar. And there, the "1" can be changed, or replaced by a variable name. If you use the most powerful construct, you can stick to that, everywhere. The code looks uniform and is fast to edit. Of course, if you do enough `when' and `unless' and three-way `if's then it will probably all look uniform to you pretty soon, as well. Personally I prefer only `if's but I'm only mildly passionate about it. For example, if I inherited code I wouldn't change the `when's and `unless'es. -- underground experts united