From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Lars Magne Ingebrigtsen Newsgroups: gmane.emacs.devel Subject: Re: return Date: Fri, 26 Nov 2010 16:45:12 +0100 Organization: Programmerer Ingebrigtsen Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1290787642 21243 80.91.229.12 (26 Nov 2010 16:07:22 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 26 Nov 2010 16:07:22 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Nov 26 17:07:17 2010 Return-path: Envelope-to: ged-emacs-devel@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 1PM0pQ-000536-36 for ged-emacs-devel@m.gmane.org; Fri, 26 Nov 2010 17:07:16 +0100 Original-Received: from localhost ([127.0.0.1]:49946 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PM0pP-0005S4-KY for ged-emacs-devel@m.gmane.org; Fri, 26 Nov 2010 11:07:15 -0500 Original-Received: from [140.186.70.92] (port=58024 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PM0W2-0007Aa-Ma for emacs-devel@gnu.org; Fri, 26 Nov 2010 10:48:23 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PM0UG-00006C-R5 for emacs-devel@gnu.org; Fri, 26 Nov 2010 10:46:39 -0500 Original-Received: from lo.gmane.org ([80.91.229.12]:39153) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PM0UG-00005a-D6 for emacs-devel@gnu.org; Fri, 26 Nov 2010 10:45:24 -0500 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1PM0UE-0006rv-P3 for emacs-devel@gnu.org; Fri, 26 Nov 2010 16:45:22 +0100 Original-Received: from cm-84.215.34.171.getinternet.no ([84.215.34.171]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 26 Nov 2010 16:45:22 +0100 Original-Received: from larsi by cm-84.215.34.171.getinternet.no with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 26 Nov 2010 16:45:22 +0100 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: emacs-devel@gnu.org Original-Lines: 59 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: cm-84.215.34.171.getinternet.no Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAFVBMVEUAAAAAAAMCAQECAQUB AAMoJCUCAQP1HVz3AAACX0lEQVQ4jU2T0XLjIAxFSerJc7LLB7iZzD63K+JnExR+AOPnbKH8/yfs lXDTMpPY5qAr6Vo2pq/9n9Fcck6EX0reDGbsYBz3+7DmlGUtnuMWYOZxPHNdW0k0rc76J+D5fL4v iwbk5O034PPlLnsp01qZ+Qm8ZwVrnpbqOejuDuA2sEglUUvhSgqG+RIrzwe30LqgsFQySaGXYX6N zLNBoW39XFZ0Q2Y/MFvGPvMLzrZ0XdcsgGSLb2zG/R1nAZBEgUVBMwwYbneYASAVAxQr6maQuJxX AT3HQ/eNChoXWyFaAxGZo3p7NJJnrNwaAAvoFqpUSHWukSjJn+m+a4qQ263GRmvkskUM0gisqw0g wsS4ARMbIuLI8QNgwpEvMLQWaxzP58ehSaiC0Z84UENMexwAvAQD/MLVhalKqdWMKqrJYYmENg51 qtBTIOVqz7hroU0RVVWtnAyOe7mhiWKDIa0SRzwaxexgQiwVRgEQFQEOMq7IU50aqqtiIUAgx0Gk ysRTkAhJqIB8cHKq6KUVx88IIg0vkklA6ACiXZYmSV6oA9nY9klzFHIbcF7BNSt8AnbvPUCGCh8O 5Jwmt247jnEqAG2TNVYvn5mSzhmA+wmuif5q99QcfXW+Ld1gKvjYwncOunbIKNnFDrQd6rVycM1y oR/ga3E7bSa+KgjO6yMdHsbCPkdmJ2+K550LMhvl8MDwefQOgE/UmRd4+g+vKX6wtVaAGU4c3w0y hhmiMiRW3jQG7mTjm+Hf5M31MbxhvI+2A1t4HniIR0tzmA8VWjIlO8wnamaHeUdnuGPt4D8yCP7p Q9R2HwAAAABJRU5ErkJggg== Mail-Copies-To: never X-Now-Playing: Radian's _Radian_: "Feedbackmikro-Citylights" User-Agent: Gnus/5.110011 (No Gnus v0.11) Emacs/24.0.50 (gnu/linux) Cancel-Lock: sha1:fZBDVZdVJ1NLkJ+BNaSD3lPwEu8= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:133172 Archived-At: Stefan Monnier writes: > If this is only "while debugging and fixing stuff", I don't think it's > a serious enough problem to warrant such a change. Well, not, that was just what I was doing moments before writing the email, so it just reminded me. But the style of doing (defun foo () (unless condition (return bar)) .. compute a bit more (unless other-condition (return zot)) ... do the real foo work here) feels kinda natural. It's what some people calls "guard based programming". Without it, you end up with (defun foo () (if (not condition) bar .., compute a bit more (if (not other-condition) zot ... do the real work))) where you have to read quite a lot of the code to find out what the exit points are. I feel like the former style often makes it easier to read the code. > Note that my preference to stick with the current situation in his > respect is not just out of inertia but also because I like a more > functional style of programming: usually/often you can find a > formulation that's just as elegant without the need for an early exit. Yeah, you're right, early returns aren't very functional in style. > I tend to agree that early exit from loops would be sometimes welcome. [...] > But I'd be OK with adding a `return' from while loops: after all > `while' loops are naturally imperative, so such a `return' would not > make things less imperative. while, dolist, dotimes... The temptation to rewrite loops using the cl-macs `loop' macro can sometimes be overwhelming, since you can return from the loop easier. But using `loop' doesn't seem to be in the Emacs Lisp style, I think -- it's not used a lot, which kinda leads me to think that most Emacs Lisp programmers don't really know how it works. And it's not always contortion-free, either. -- (domestic pets only, the antidote for overdose, milk.) larsi@gnus.org * Lars Magne Ingebrigtsen