From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Yuri Khan Newsgroups: gmane.emacs.devel Subject: Re: Why is there no `until' in elisp? Date: Wed, 17 Oct 2018 16:46:08 +0700 Message-ID: References: <87murdu6to.fsf@portable.galex-713.eu> <87lg6xgc58.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 1539769698 14947 195.159.176.226 (17 Oct 2018 09:48:18 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 17 Oct 2018 09:48:18 +0000 (UTC) Cc: Stefan Monnier , Emacs developers To: galex-713@galex-713.eu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Oct 17 11:48:14 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 1gCiR1-0003lj-RL for ged-emacs-devel@m.gmane.org; Wed, 17 Oct 2018 11:48:11 +0200 Original-Received: from localhost ([::1]:34994 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gCiT8-0005TA-Am for ged-emacs-devel@m.gmane.org; Wed, 17 Oct 2018 05:50:22 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:47756) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gCiPH-0003h7-P1 for emacs-devel@gnu.org; Wed, 17 Oct 2018 05:46:24 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gCiPF-0007X5-Fz for emacs-devel@gnu.org; Wed, 17 Oct 2018 05:46:23 -0400 Original-Received: from mail-oi1-x22a.google.com ([2607:f8b0:4864:20::22a]:45701) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gCiPE-0007UW-RR for emacs-devel@gnu.org; Wed, 17 Oct 2018 05:46:21 -0400 Original-Received: by mail-oi1-x22a.google.com with SMTP id e17-v6so20520857oig.12 for ; Wed, 17 Oct 2018 02:46:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=HrZH+YxGjyLZjoaI0IiunSQeJmb/fltHFcGBzmOhnzA=; b=g1nVagw/6nCdRCrO3cJGawIhv+bLj5BAjlkKz1b8+pK0jNWh84dnImr0tH47xyJm+a YTAognvAqmiOe4txLQ4Ldqzmk+Nv8rMrmsKx9lQjQfPZPHOLHsJE2ON99kd1goGvGcEC wMEnWBcznjGAtwUzZf53HXfiJjm6SA2jg/D9aNIymQM6VsCq6apPU05UEQKUV8S8OuLG A2rbHSCatiiw1UH0HChwl0bpWBugog/BYmU+cIDE2bi+0nWo0hLCsaqq7PAB/QiXExH/ rIbFZk3LtJBfHMl6uYSGuwNbGtUlb/tkQKcReqd78uDuQdUv8/+mocnycKzaFSYaqHx2 uNDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=HrZH+YxGjyLZjoaI0IiunSQeJmb/fltHFcGBzmOhnzA=; b=Q+ZCfxCQE3KnSaz1af5G2j9iMX0zCLlrrDvfVTXtNUaA3Qb2kcmOpbE6b77ySOJyTH txXgB0qWNzdd7CZnHOsUa1XT0Knd6xaxsgU0PPql9bJzmRq+5oUnsR4yvtQftEk2rRqf u5Dpfu10SefEtV/Wp1nTrN8TdlAtkBblwYqX+rYty+TPwkjLejCXpfN3nCrbNLrComLG WDaLjF/ttLmKLJSvrGryVaAea9QA3+lAsNJob2ijqXvm0MBDlPsy8dlg9JkjTLf4kaPH uRSC2weL+wNh/6NcJVOTSFwGLQYJLTMUFpTRg7QDyolckoCmw9sHr07aASPa4KtFNN4L 5+tA== X-Gm-Message-State: ABuFfohEXaq47vjchO3WB3s7izFnWe7B3wXOA3Fn/pZmrKnTpzsJeKVc P5VBnlVqhTtHl8zcol2dxpVAYXR3WWfD95YXqp+rdw== X-Google-Smtp-Source: ACcGV60FBB3LFnGqYr7R9Zct1ywpY1mnV4jXW8qvRSGgyFp9fEBBQGRT0pNIWdlN5+Ua83xKpZiAEQcvI7PNEUn6k/g= X-Received: by 2002:aca:d084:: with SMTP id j4-v6mr14160238oiy.170.1539769580128; Wed, 17 Oct 2018 02:46:20 -0700 (PDT) In-Reply-To: <87lg6xgc58.fsf@portable.galex-713.eu> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::22a 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:230439 Archived-At: On Wed, Oct 17, 2018 at 4:23 PM Garreau, Alexandre wrote: > > Something such as the C =E2=80=9Cdo=E2=80=9D construct might overcomplica= te 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. The post-condition loop enables the =E2=80=9Cat-least-once=E2=80=9D case, w= hich is also occasionally useful, e.g.: Attempt an API call until it succeeds. > > 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. + Well, you mentioned the C =E2=80=98do=E2=80=99/=E2=80=98while=E2=80=99, f= or one; it is a continuation post-condition loop. C++, Java, PHP, Javascript and many other languages inherited that. + Pascal has =E2=80=98repeat=E2=80=99/=E2=80=98until=E2=80=99 (a terminatio= n post-condition loop), and it was my first association for the name =E2=80=98until=E2=80=99. =E2=88=92 Bash=E2=80=99s =E2=80=98until=E2=80=99/=E2=80=98do=E2=80=99/=E2= =80=98done=E2=80=99 is a termination pre-condition loop, you=E2=80=99re rig= ht. + In Perl, both =E2=80=98while=E2=80=99 (continuation) and =E2=80=98until= =E2=80=99 (termination) can be used as pre-conditions and post-conditions.