Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Block comments ala Ray
- X-seq: zsh-workers 48024
- From: Stephane Chazelas <stephane@xxxxxxxxxxxx>
- To: Lawrence Velázquez <vq@xxxxxxxxx>, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>, zsh-workers@xxxxxxx
- Subject: Re: Block comments ala Ray
- Date: Fri, 12 Feb 2021 21:12:35 +0000
- Archived-at: <https://zsh.org/workers/48024>
- Archived-at: <http://www.zsh.org/sympa/arcsearch_id/zsh-workers/2021-02/20210212211235.wceitj3w5qr4bv3x%40chazelas.org>
- In-reply-to: <20210212210236.rsmrs65lmtxzoqzc@chazelas.org>
- List-id: <zsh-workers.zsh.org>
- Mail-followup-to: Lawrence Velázquez <vq@xxxxxxxxx>, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>, zsh-workers@xxxxxxx
- References: <CAH+w=7YZREq7FbJCCoWoJ-vQ7+P5Z=_mKB-aStoMiBRupqD_wA@mail.gmail.com> <CAN=4vMonpZHPSarsC778_GMbD_h4ioTwT+bTFU=FZ7_zbXaMqQ@mail.gmail.com> <CAH+w=7Zd2gY-s5T1dDNEEujAh6197MzrUD-iZrVwZLzD=L7xVQ@mail.gmail.com> <CAN=4vMoYj3WbBk3BL98buiYcf7rkLtw=b9v_f0p1C4zqYRB7xg@mail.gmail.com> <20210212074031.7746vg37xykniem5@chazelas.org> <CAH+w=7ZT3vgGVd_NAndnDt2zbLwGV3Pwu=7+utEuwvSkKd4jOA@mail.gmail.com> <20210212154547.iy35rp4ijaef22ld@chazelas.org> <CAH+w=7bLXK_rZPsx33BTyKb5Q43uPc3W4Ayf0A8Gfkik0W9r9A@mail.gmail.com> <B2B62C95-EEDF-442A-9ACA-75EE653CEB72@larryv.me> <20210212210236.rsmrs65lmtxzoqzc@chazelas.org>
2021-02-12 21:02:36 +0000, Stephane Chazelas:
[...]
> as the parsing of the inside of `...` is deferred in all shells
> except ash-based ones; see $shell -c ':||echo `for`'. A bit like
> in eval 'echo x # comment'.
>
> It's also deferred with the $(...) form in bash (but bash only
> AFAICT):
>
> $ bash -c $'f() { echo $(echo x # comment\n); }; typeset -f f'
> f ()
> {
> echo $(echo x # comment
> )
> }
[...]
Hmmm, actually in zsh, there is parsing going on there:
$ zsh -c 'f() { echo $(for); }; typeset -f f'
zsh: parse error near `)'
zsh:1: parse error near `$(for); }; typeset -...'
But still, the comments appear not to be discarded at that point:
$ zsh -c $'f() { echo $(echo x # comment\n); }; typeset -f f; f'
f () {
echo $(echo x # comment
)
}
x
--
Stephane
Messages sorted by:
Reverse Date,
Date,
Thread,
Author