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: return Date: Fri, 26 Nov 2010 09:57:21 +0100 Organization: Programmerer Ingebrigtsen Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1290761869 28077 80.91.229.12 (26 Nov 2010 08:57:49 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 26 Nov 2010 08:57:49 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Nov 26 09:57:45 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 1PLu7k-0003do-3u for ged-emacs-devel@m.gmane.org; Fri, 26 Nov 2010 09:57:44 +0100 Original-Received: from localhost ([127.0.0.1]:59197 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PLu7j-0005fx-Or for ged-emacs-devel@m.gmane.org; Fri, 26 Nov 2010 03:57:43 -0500 Original-Received: from [140.186.70.92] (port=42092 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PLu7c-0005fj-Ml for emacs-devel@gnu.org; Fri, 26 Nov 2010 03:57:40 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PLu7Y-0007Ua-Ee for emacs-devel@gnu.org; Fri, 26 Nov 2010 03:57:36 -0500 Original-Received: from lo.gmane.org ([80.91.229.12]:37210) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PLu7Y-0007UU-4X for emacs-devel@gnu.org; Fri, 26 Nov 2010 03:57:32 -0500 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1PLu7X-0003XP-2I for emacs-devel@gnu.org; Fri, 26 Nov 2010 09:57:31 +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 09:57:31 +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 09:57:31 +0100 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: emacs-devel@gnu.org Original-Lines: 63 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: cm-84.215.34.171.getinternet.no Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAJFBMVEUPBhLr2tZYN0zf0M0F AQrq2NOrnJ81JTX87+Lw4Njo1tAXDhqXiSeEAAACYElEQVQ4jWWQvW/bMBDFOXjzRBQqwIwMIALt lBDx4MmDtk5swALyKAEskJFDOXjsYo9CkUDMZggazEmbBv1zvaM+EieEYJP3u/fukcQYKZn3vsIf f1wWWQCt6DtwioB6VlEG9fqDgqKAXjkBKOUdZZ5+BhIBoxQH1R8BZRUU6/pUXwEFPiA4XeVFcKaR YGC2SEgJoWgSPzoOGichYP7Lw00LOqUxG/MT2EJ727Ra3WiqlAZQLwBQCIC11m3uZwWmYr5qaaLh 04q9A57VvsX5qtIaJSeP4A6TnHyMRXWrMJmP92AY8fS1BE2SvAMPuD1WRbrXVCutFyDPuHtxfBtU 0CpJ8hzBNARA+hR0aBV9DghS9IIh1U+XliGEfdD7gFYcJWdF1b1NpQzjyv0zsSjZtgmC0DTbCC75 K+ltCpKg2YtN1X5ReLLuOQYLj4XjZZgULYIhSuS9ddY+NTJso6Ihs+S3c5x/C80keCSEjBLhLID2 Nd+HfV7XvxD0EGzjUHELz/HatPDuLyRKTFkKJLfgLsstgL8I1iApORB7Gy6PxpSX+vgP+jGYkVwI 69IQNgW8RWg20N/FKdYJy9NGGuG4MaYgu/UwDL01wkLlj9wUhwFIIUYwWC44585Kww/xNMAMXD34 cC4ACDy6A4Co6OE9gNhN8R1OWJoUQ7wfdwZGdLEw1VECgBveRQsS/2YzCGBErMRrz27gBQkOWOqG riMjHCXCiW4Fx0m0ymaJ6w8k25FoQXYky7I5Qgdd2WhBdlDPxusP3QoP2Qiycb9+qyN5A9E2mxc4 wOEHNOJEsloANP4HPirC4ZsvxwwAAAAASUVORK5CYII= Mail-Copies-To: never X-Now-Playing: Tiny Vipers's _Life on Earth_: "Life on Earth" User-Agent: Gnus/5.110011 (No Gnus v0.11) Emacs/24.0.50 (gnu/linux) Cancel-Lock: sha1:lUKmIUhjwi+ab/bcaWtKxbP1U6s= 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:133149 Archived-At: Wouldn't it be nice if Emacs Lisp had a workable early-return mechanism? (This is where Andreas chimes in with "What's wrong with ?") While debugging and fixing stuff, I often find myself in the situation of adding more if/cond statements to a function and pushing the original body further in. I think this usually leads to less clear code. Like with (defun foo () ... lots of code) the options are usually (defun foo () (if zot t ... lots of code)) or (the horror!) (defun foo () (block nil (when zot (return t)) ... lots of code)) or (defun foo () (if zot t (foo-1))) (defun foo-1 () ... lots of code) and so on. I think the ideal way to deal with this is to be more C-ish, and say (defun foo () (when zot (return t)) ... lots of code) That is, I think it would probably be pretty nice if every defun establishes a nil block. So this wouldn't be a Common Lisp-ism, but better! :-) (If we want to avoid confusion with the CL return, then we could call it something else, like freturn.) This isn't the only use case, of course. A lot of functions in Emacs go through pretty awkward contortions to end loops when certain conditions occur. A simple return from the middle of a complex series of loops can often make the code a lot more readable. (And probably faster.) Thoughts? -- (domestic pets only, the antidote for overdose, milk.) larsi@gnus.org * Lars Magne Ingebrigtsen