Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Block comments ala Ray
- X-seq: zsh-workers 48011
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: Re: Block comments ala Ray
- Date: Thu, 11 Feb 2021 22:17:10 -0800
- Archived-at: <https://zsh.org/workers/48011>
- Archived-at: <http://www.zsh.org/sympa/arcsearch_id/zsh-workers/2021-02/CAH%2Bw%3D7Zd2gY-s5T1dDNEEujAh6197MzrUD-iZrVwZLzD%3DL7xVQ%40mail.gmail.com>
- In-reply-to: <CAN=4vMonpZHPSarsC778_GMbD_h4ioTwT+bTFU=FZ7_zbXaMqQ@mail.gmail.com>
- List-id: <zsh-workers.zsh.org>
- References: <CAH+w=7YZREq7FbJCCoWoJ-vQ7+P5Z=_mKB-aStoMiBRupqD_wA@mail.gmail.com> <CAN=4vMonpZHPSarsC778_GMbD_h4ioTwT+bTFU=FZ7_zbXaMqQ@mail.gmail.com>
On Tue, Feb 9, 2021 at 10:16 PM Roman Perepelitsa
<roman.perepelitsa@xxxxxxxxx> wrote:
>
> On Wed, Feb 10, 2021 at 7:05 AM Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> >
> > !# This begins a block comment.
> > This is merely rambling.
> > This #! is the last line of the block
>
> This can be very surprising because it's not how block comments work
> in other popular languages.
I don't find that very compelling, because in shell the alternative is
to prefix every line with "#", which is exactly what Ray wants to
avoid.
It might be possible to force it to look
!#
like this
#!
(that is, require newlines both before and after the delimiters), if
that seems more friendly, but then the question is what
!#
this
#! means
(did the block end, and if it did not then ...)?
> It also disallows inline comments --
> something I personally use in other languages.
Do you have inline comments in the shell now? Do you only care about
inline comments that don't contain newlines? As I mentioned, I
experimented with
print this <# is an inline #> comment
because "<#" in any existing script would be a syntax error; but as
soon as you allow newlines within the comment it becomes a verbose
form of backslash-newline continuation, which felt wrong.
Do you disagree with me about how strangely this --
print this <# part is a comment
(lah-di-dah for perhaps hundreds of lines)
but this part #> is the rest of the command
-- implicitly behaves if the embedded newlines can be inlined?
> I would go even further and say that the value provided by block
> comments resides almost exclusively in enabling inline comments.
I think Ray at least disagrees with you, since he's willing to abuse
here-documents for the purpose, which also can't be inlined.
Do you not use block comments to delimit expository paragraphs?
Messages sorted by:
Reverse Date,
Date,
Thread,
Author