From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: "Garreau\, Alexandre" Newsgroups: gmane.emacs.devel Subject: Re: Why is there no `until' in elisp? Date: Wed, 17 Oct 2018 23:15:19 +0200 Message-ID: <87d0s86zrs.fsf@portable.galex-713.eu> References: <87murdu6to.fsf@portable.galex-713.eu> <87lg6xgc58.fsf@portable.galex-713.eu> <86294998-2c96-a1be-6a83-2e34b7fa6046@cs.ucla.edu> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1539810875 9376 195.159.176.226 (17 Oct 2018 21:14:35 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 17 Oct 2018 21:14:35 +0000 (UTC) User-Agent: Gnus (5.13), GNU Emacs 25.1.1 (i686-pc-linux-gnu) Cc: Yuri Khan , Stefan Monnier , Emacs developers To: Paul Eggert Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Oct 17 23:14:30 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gCt9A-0002L7-Mf for ged-emacs-devel@m.gmane.org; Wed, 17 Oct 2018 23:14:28 +0200 Original-Received: from localhost ([::1]:39147 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gCtBH-0008HG-6U for ged-emacs-devel@m.gmane.org; Wed, 17 Oct 2018 17:16:39 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45497) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gCtAC-0008E7-Li for emacs-devel@gnu.org; Wed, 17 Oct 2018 17:15:33 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gCtA8-0003yl-Tm for emacs-devel@gnu.org; Wed, 17 Oct 2018 17:15:30 -0400 Original-Received: from portable.galex-713.eu ([2a00:5884:8305::1]:51386) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gCtA7-0003yR-Jt for emacs-devel@gnu.org; Wed, 17 Oct 2018 17:15:28 -0400 Original-Received: from localhost ([::1] helo=portable.galex-713.eu) by portable.galex-713.eu with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1gCt9z-0005tR-S8; Wed, 17 Oct 2018 23:15:19 +0200 X-GPG-FINGERPRINT: E109 9988 4197 D7CB B0BC 5C23 8DEB 24BA 867D 3F7F X-Accept-Language: fr, en, it, eo In-Reply-To: <86294998-2c96-a1be-6a83-2e34b7fa6046@cs.ucla.edu> (Paul Eggert's message of "Wed, 17 Oct 2018 10:50:34 -0700") X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:5884:8305::1 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 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" Xref: news.gmane.org gmane.emacs.devel:230462 Archived-At: On 2018-10-17 at 10:50, Paul Eggert wrote: > On 10/17/18 2:46 AM, Yuri Khan wrote: >> + Pascal has =E2=80=98repeat=E2=80=99/=E2=80=98until=E2=80=99 (a termina= tion post-condition loop), and >> it was my first association for the name =E2=80=98until=E2=80=99. > > Pascal did it right, for a reason I haven't seen mentioned in this > thread. The natural tendency when reading a conditional is to assume > that the condition will be true in the code that immediately follows > the text of the condition. I disagree: what you say maybe is because we were used to it by programming languages, or (wrongly) teached to (just as new programmers nowadays learn to use a tons of useless temporary variables until they forget what an =E2=80=9Cexpression=E2=80=9D is), but linguistically it perf= ectly makes sense =E2=80=9Cuntil null repeat=E2=80=9D: #+BEGIN_SRC emacs-lisp (until (zerop n) s) #+END_SRC Also, =E2=80=9Cwhile=E2=80=9D we=E2=80=99re talking about programming, note= how =E2=80=9Cwhile=E2=80=9D as used in natural language does *not* mean the same thing (as it express contemporarity, not condition), because it is a lot less meaningful, hence useful. =E2=80=9CWhile=E2=80=9D is one of these artificial different= ly-meaning constructs idiosyncratic to programming just as =E2=80=9Celse=E2=80=9D (ins= tead of =E2=80=9Cotherwise=E2=80=9D). It is still more natural and meaningful to say =E2=80=9Cuntil I=E2=80=99m n= ot hungry anymore I eat=E2=80=9D instead of =E2=80=9Cwhile I=E2=80=99m hungry I eat= =E2=80=9D, just as we=E2=80=99d prefer to say =E2=80=9Cuntil mail finished, write=E2=80=9D rather than =E2=80=9Cwh= ile mail not finished, write=E2=80=9D. If =E2=80=9Cuntil=E2=80=9D exists in english, it= =E2=80=99s for a reason. If ever it gets different in anything conveying a meaning, it=E2=80=99s going = to be for a reason too, but as english exist since longer than pascal (though it depends of what you mean by english and pascal x))=E2=80=A6 > It does not work for the confusing C syntax 'do S1 while > (C); S2' where C is false just before S2 is executed. Because C implements no until, nor for pre nor post cond. > It also does not work for the proposed Elisp syntax (until C S), where > C would be false just before S is executed.=20 In my mind this is wrong: we even should have the opposite, have when based on until instead of the opposite. > Pascal's 'repeat S1 until C; S2' where C is true just before S2 is > executed. > Because of this elementary psychological principle, I believe post-cond should be at the discretion of the programmer and not be an arbitrary language decision based on some non-reproducible psychological subjective observation. This might as well become a style guideline, but then I feel like it should be explicitely stated and agreed upon before enforcing it in any software. > the Elisp syntax for the proposed loop construct should *not* be > (until C S). And what should it be then? (repeat S until C) (begins to feel like foof-loop, then you could just go for foof-loop)? (until S C) (extremely counterintuitive, as, in english, =E2=80=9Cuntil=E2=80=9D *always* serves a= s a *preposition* to what it is about)?