Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Block comments ala Ray
- X-seq: zsh-workers 48037
- From: Stephane Chazelas <stephane@xxxxxxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- Cc: Lawrence Velázquez <vq@xxxxxxxxx>, "zsh-workers@xxxxxxx" <zsh-workers@xxxxxxx>
- Subject: Re: Block comments ala Ray
- Date: Sat, 13 Feb 2021 07:37:46 +0000
- Archived-at: <https://zsh.org/workers/48037>
- Archived-at: <http://www.zsh.org/sympa/arcsearch_id/zsh-workers/2021-02/20210213073746.z2ruehp5jw7l55ry%40chazelas.org>
- In-reply-to: <CAH+w=7adbKLjyn_qyp5V7mNnLMjiaC9JygHL-UCwbVH=JJsaSQ@mail.gmail.com>
- List-id: <zsh-workers.zsh.org>
- Mail-followup-to: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>, Lawrence Velázquez <vq@xxxxxxxxx>, "zsh-workers@xxxxxxx" <zsh-workers@xxxxxxx>
- References: <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> <20210212211235.wceitj3w5qr4bv3x@chazelas.org> <CAH+w=7adbKLjyn_qyp5V7mNnLMjiaC9JygHL-UCwbVH=JJsaSQ@mail.gmail.com>
2021-02-12 13:29:48 -0800, Bart Schaefer:
> On Fri, Feb 12, 2021 at 1:12 PM Stephane Chazelas <stephane@xxxxxxxxxxxx> wrote:
> >
> > 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
>
> The literal text of what's contained in $(...) is retained
[...]
You're right. It looks like the contents is parsed (I suppose to
be able to handle the case x in x)... and the like inside), but
the result of that parsing seems to be discarded, and it seems
the contents of that $(...) is parsed again each time the
function is invoked.
ksh93 does appear to do the same. bash as well, but it's unclear
to me what kind of parsing it does in the first round.
See for instance:
$ bash -xc 'echo $(foo case a in a); esac)'
++ foo case a in a
bash: foo: command not found
+ echo '; esac)'
; esac)
--
Stephane
Messages sorted by:
Reverse Date,
Date,
Thread,
Author