|
From: | Paul Eggert |
Subject: | Re: Why is there no `until' in elisp? |
Date: | Wed, 17 Oct 2018 10:50:34 -0700 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 |
On 10/17/18 2:46 AM, Yuri Khan wrote:
+ Pascal has ‘repeat’/‘until’ (a termination post-condition loop), and it was my first association for the name ‘until’.
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. This works for (if C S) and (while C S), and it also works for Pascal's 'repeat S1 until C; S2' where C is true just before S2 is executed. It does not work for the confusing C syntax 'do S1 while (C); S2' where C is false just before S2 is executed. It also does not work for the proposed Elisp syntax (until C S), where C would be false just before S is executed. Because of this elementary psychological principle, the Elisp syntax for the proposed loop construct should *not* be (until C S).
[Prev in Thread] | Current Thread | [Next in Thread] |