Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Block comments ala Ray
- X-seq: zsh-workers 48038
- From: Stephane Chazelas <stephane@xxxxxxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- Cc: Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: Re: Block comments ala Ray
- Date: Sat, 13 Feb 2021 08:35:21 +0000
- Archived-at: <https://zsh.org/workers/48038>
- Archived-at: <http://www.zsh.org/sympa/arcsearch_id/zsh-workers/2021-02/20210213083521.kv3y3qzfnaffflfh%40chazelas.org>
- In-reply-to: <CAH+w=7YZREq7FbJCCoWoJ-vQ7+P5Z=_mKB-aStoMiBRupqD_wA@mail.gmail.com>
- List-id: <zsh-workers.zsh.org>
- Mail-followup-to: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>, Zsh hackers list <zsh-workers@xxxxxxx>
- References: <CAH+w=7YZREq7FbJCCoWoJ-vQ7+P5Z=_mKB-aStoMiBRupqD_wA@mail.gmail.com>
2021-02-09 22:05:13 -0800, Bart Schaefer:
[...]
> !# This begins a block comment.
> This is merely rambling.
> This #! is the last line of the block
[...]
I can't say I like it much either.
- those !#, #! look too much like a shebang. Also consider
scripts that do:
cat > script <<EOF
#! /bin/sh -
...
EOF
making it difficult to comment out those codes
- !# is already histsubst syntax.
- It's also the !# extendedglob
- It's also (POSIXly) invoking the !# command.
- syntax is a bit obscure and uncommon. Would we allow blanks
before the !# for indentation purposes. Would those !# be
recognised if the previous line ends in a \ or inside
heredocs? Does it have to be delimited with whitespace? Can we
use !########### .. ##############!? That ! is easy to miss.
Would we allow escaping the closing #!? How?
- assuming we allow nesting (which would be useful to comment
out sections of code that contain block comments), it will be
harder to follow than with C's #if...#endif or
:||:<<'EOC'...EOC
Other possible avenues:
- <<# .. #>> allows inline comments, but looks more like a
redirection operator than a comment.
- alternatively: <<#EOC .. EOC (or <<#{...} <<#[...] and the
usual pairs) to make nesting easier.
- The =word .. =cut of perl: conflicts with zsh's =cmd operator,
not nestable put would allow pod inline documentation.
To me, there are more useful features that could be added to zsh
before that one. In that vein, I'm thinking of quotes like
python's '''...''' or perl's q(...)/qq(...) or ruby's %q{...}
operator for things like
ssh host %{
blah | sed 's/\./.../'
}
Or ksh's <#((...)), <#.. <>; redirection operators.
--
Stephane
Messages sorted by:
Reverse Date,
Date,
Thread,
Author