[Top][All Lists]

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

Re: select syntax violates the POLA

From: konsolebox
Subject: Re: select syntax violates the POLA
Date: Mon, 5 Apr 2021 13:53:23 +0800

On Mon, Apr 5, 2021 at 12:46 PM Robert Elz <kre@munnari.oz.au> wrote:
>     Date:        Sun, 04 Apr 2021 20:27:15 -0400
>     From:        worley@alum.mit.edu (Dale R. Worley)
>     Message-ID:  <87wntha84c.fsf@hobgoblin.ariadne.com>
>   | The manual page says
>   |
>   |        if list; then list; [ elif list; then list; ] ... [ else list; ] fi
>   |
>   | so clearly there should be a ; or newline before the list in the
>   | else-clause.
> You're assuming that the manual is a precise specification of what
> is allowed.  It isn't.  At least in this case it shows something that
> works, so if you write an if statement that way, it will function.
> That does not imply that there are not other methods.

The manual itself may be lacking in some places but the syntax here is
explicit. There's no reason to follow otherwise. These "other methods"
can only be an implementation mistake or a compromise that's not
exactly a supported functionality or feature. This case where () and
{} are allowed to not end with semicolon before 'else' when others
aren't is likely one.

> and the ';' there is just an
> indication that something must ensure that the word that follows is
> correctly interpreted as a reserved word (when one is required).

Then why does it not work with other keywords that begin a block?  The
enclosure of {} and () should make semicolons optional for parsing
with them as well.  This should have been explicitly allowed by the
shell.  It's highly doable even if they are followed with
non-keywords.  Just look at awk's syntax.


reply via email to

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