[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Why is there no `until' in elisp?

From: Garreau\, Alexandre
Subject: Re: Why is there no `until' in elisp?
Date: Wed, 17 Oct 2018 23:15:19 +0200
User-agent: Gnus (5.13), GNU Emacs 25.1.1 (i686-pc-linux-gnu)

On 2018-10-17 at 10:50, Paul Eggert wrote:
> 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.

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 “expression” is), but linguistically it perfectly makes
sense “until null repeat”:

#+BEGIN_SRC emacs-lisp
(until (zerop n)

Also, “while” we’re talking about programming, note how “while” 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.  “While” is one of these artificial differently-meaning
constructs idiosyncratic to programming just as “else” (instead of

It is still more natural and meaningful to say “until I’m not hungry
anymore I eat” instead of “while I’m hungry I eat”, just as we’d prefer
to say “until mail finished, write” rather than “while mail not
finished, write”.  If “until” exists in english, it’s for a reason.  If
ever it gets different in anything conveying a meaning, it’s 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))…

> 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. 

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

> 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, “until” *always* serves as a
*preposition* to what it is about)?

reply via email to

[Prev in Thread] Current Thread [Next in Thread]