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 11:23:15 +0200 Message-ID: <87lg6xgc58.fsf@portable.galex-713.eu> References: <87murdu6to.fsf@portable.galex-713.eu> 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 1539768147 3929 195.159.176.226 (17 Oct 2018 09:22:27 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 17 Oct 2018 09:22:27 +0000 (UTC) User-Agent: Gnus (5.13), GNU Emacs 25.1.1 (i686-pc-linux-gnu) Cc: Stefan Monnier , Emacs developers To: Yuri Khan Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Oct 17 11:22:23 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 1gCi22-0000tW-03 for ged-emacs-devel@m.gmane.org; Wed, 17 Oct 2018 11:22:22 +0200 Original-Received: from localhost ([::1]:34876 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gCi48-00027g-Ei for ged-emacs-devel@m.gmane.org; Wed, 17 Oct 2018 05:24:32 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41867) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gCi38-0001eI-6b for emacs-devel@gnu.org; Wed, 17 Oct 2018 05:23:31 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gCi32-0002dR-SU for emacs-devel@gnu.org; Wed, 17 Oct 2018 05:23:26 -0400 Original-Received: from portable.galex-713.eu ([2a00:5884:8305::1]:41858) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gCi2y-0002YF-5Y for emacs-devel@gnu.org; Wed, 17 Oct 2018 05:23:21 -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 1gCi2u-0003dI-2u; Wed, 17 Oct 2018 11:23:16 +0200 X-GPG-FINGERPRINT: E109 9988 4197 D7CB B0BC 5C23 8DEB 24BA 867D 3F7F X-Accept-Language: fr, en, it, eo In-Reply-To: (Yuri Khan's message of "Wed, 17 Oct 2018 15:04:43 +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:230438 Archived-At: On 2018-10-17 at 15:04, Yuri Khan wrote: > In both these implementations, =E2=80=98until=E2=80=99 is still a pre-con= dition loop > (same as =E2=80=98while=E2=80=99, but with the condition negated). Something such as the C =E2=80=9Cdo=E2=80=9D construct might overcomplicate= the language, while I think normal `while' and `until' are not only simpler but also superior: with those you have the case of 0 loops, in which basically works as a when. > However, in many languages that have an =E2=80=98until=E2=80=99 loop as a= language > construct, it is a post-condition loop. The body is executed first, > then the condition is evaluated. Which languages? I looked again in bash to be sure, and bash doesn=E2=80= =99t do that. > Of course, that raises additional questions=E2=80=A6 > > * Should a hypothetical ELisp =E2=80=98until=E2=80=99 macro implement a p= ost-condition loop? I find this a useless discrepancy, coming from inconsistent languages, that shouldn=E2=80=99t be imported in elisp. Which is less bad than others= in this respect. > * If so, should the condition be passed as the last argument? I guess so, it=E2=80=99d be confusing otherwise. Yet from a low level standpoint it=E2=80=99s not trivial (you need last arg of the linked list, = but you might just as well delay the problem by just using `progn'), but this time I feel this stays elegant enough as the other form present no real advantages. > * If so, how should indentation work? (indent the body 4 spaces, > condition 2 spaces?) I guess=E2=80=A6 can (indent =E2=80=A6) declaration constructs allow that? > * The macro will then have to take body and condition as a single > &rest list, and split it, right? Yes I think. Since here it=E2=80=99s a lot more crucial and important than= a basic side-effects / not-always-used thing such as `progn' (though if I wanted to make `progn' look more functional I=E2=80=99d do the same for it,= as an option). I=E2=80=99ve alway found sad that `defun' &args specs were not powerful eno= ugh for this kind of things (&rest rest &optional last), or even supporting docstrings (although that requires typing so=E2=80=A6).