zsh-workers
 help / color / mirror / code / Atom feed
* Problems in `zshmisc` manual page
@ 2022-04-24  7:12 Emily Seville
  2022-04-24  8:12 ` Lawrence Velázquez
  0 siblings, 1 reply; 2+ messages in thread
From: Emily Seville @ 2022-04-24  7:12 UTC (permalink / raw)
  To: zsh-workers

[-- Attachment #1: Type: text/plain, Size: 3325 bytes --]

There are several issues in complex commands descriptions.

*if command*
>
> if list then list [ elif list then list ] ... [ else list ] fi
>               The  if list is executed, and if it returns a zero exit
> status, the then list is executed.  Otherwise, the elif list is executed
>               and if its status is zero, the then list is executed.  If
> each elif list returns nonzero status, the else list is executed.


There is no mention of a terminator after *list*. It's better to rewrite
command description as:

if list *term* then list *term* [ elif list *term *then list *term *] ... [
> else list *term *] fi

              The  if list is executed, and if it returns a zero exit
> status, the then list is executed.  Otherwise, the elif list is executed
>               and if its status is zero, the then list is executed.  If
> each elif list returns nonzero status, the else list is executed.


*for command*

>        for name ... [ in word ... ] term do list done
>               Expand the list of words, and set the parameter name to each
> of them in turn, executing list each time.  If  the  `in  word'  is
>               omitted, use the positional parameters instead of the words.
>               The term consists of one or more newline or ; which
> terminate the words, and are optional when the `in word' is omitted.
>               More  than one parameter name can appear before the list of
> words.  If N names are given, then on each execution of the loop the
>               next N words are assigned to the corresponding parameters.
> If there are more names than remaining words, the remaining  parame‐
>               ters  are each set to the empty string.  Execution of the
> loop ends when there is no remaining word to assign to the first name.
>               It is only possible for in to appear as the first name in
> the list, else it will be treated as marking the end of the list.

It's better to write at my glance:

>        for name ... [ in word ... ] term do list *term* done
>               Expand the list of words, and set the parameter name to each
> of them in turn, executing list each time.  If  the  `in  word'  is
>               omitted, use the positional parameters instead of the words.
>               The term consists of one or more newline or ; which
> terminate the words, and are optional when the `in word' is omitted.
>               More  than one parameter name can appear before the list of
> words.  If N names are given, then on each execution of the loop the
>               next N words are assigned to the corresponding parameters.
> If there are more names than remaining words, the remaining  parame‐
>               ters  are each set to the empty string.  Execution of the
> loop ends when there is no remaining word to assign to the first name.
>               It is only possible for in to appear as the first name in
> the list, else it will be treated as marking the end of the list.

The same issues applies for:

   - for (second form)
   - while
   - until
   - repeat

-- 
*# Best regards, Emily Grace Seville.*
*[contacts]*
site *=* "*https://emilyseville7cfg.github.io/about/
<https://emilyseville7cfg.github.io/about/>"*
phone *=* "+79247259451*"*

[-- Attachment #2: Type: text/html, Size: 5350 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Problems in `zshmisc` manual page
  2022-04-24  7:12 Problems in `zshmisc` manual page Emily Seville
@ 2022-04-24  8:12 ` Lawrence Velázquez
  0 siblings, 0 replies; 2+ messages in thread
From: Lawrence Velázquez @ 2022-04-24  8:12 UTC (permalink / raw)
  To: Emily Seville; +Cc: zsh-workers

[-- Attachment #1: Type: text/plain, Size: 826 bytes --]

> On Apr 24, 2022, at 3:13 AM, Emily Seville <emilyseville7cf@gmail.com> wrote:
> 
> There is no mention of a terminator after list. It's better to rewrite command description as:
> 
>> if list term then list term [ elif list term then list term ] ... [ else list term ] fi

I don’t see the need for this. The term “list” is already defined to include the terminator, so replacing every instance of “list” with “list term” would be incorrect, repetitive, and visually noisy.

> A list is a sequence of zero or more sublists, in which each sublist is terminated by ‘;’, ‘&’, ‘&|’, ‘&!’, or a newline. This terminator may optionally be omitted from the last sublist in the list when the list appears as a complex command inside ‘(...)’ or ‘{...}’.

-- 
vq
Sent from my iPhone

[-- Attachment #2: Type: text/html, Size: 3011 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-04-24  8:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-24  7:12 Problems in `zshmisc` manual page Emily Seville
2022-04-24  8:12 ` Lawrence Velázquez

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).