Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Block comments ala Ray



Bart Schaefer wrote on Fri, Feb 12, 2021 at 08:55:04 -0800:
> On Fri, Feb 12, 2021 at 7:45 AM Stephane Chazelas <stephane@xxxxxxxxxxxx> wrote:
> >
> > 2021-02-12 07:30:23 -0800, Bart Schaefer:
> > > On Thu, Feb 11, 2021 at 11:40 PM Stephane Chazelas
> > > <stephane@xxxxxxxxxxxx> wrote:
> > > >
> > > > :||:<<'# some comment'
> > >
> > > That's exactly what the zsh-users discussion has been telling Ray he
> > > should not do, because at some point it's not going to work the way he
> > > expects.
> > [...]
> >
> > How so?
> 
> What was said on zsh-users (not by me):
> 
> "Here-documents are not comments, despite your best efforts to abuse
> them for that role."
> 
> "The construct you use has side-effects you've overlooked, which mean
> your fashion of comments will backfire in a way that you don't see yet."

For context, that's me from users/26342.  The original paragraph also spells
out that the "side-effects" in question are that lastval will be reset.

> (Paraphrased) There are places where you might want comments but that
> command syntax is not allowed, for example in the midst of "for ...
> do".
> 
> > How would it be different from your !# .. #! ?
> 
> For one thing, the content of a here-document is "compiled" into the
> wordcode of the script or function, even if the command referencing
> that here-document is never going to execute.   True comments are
> discarded during lexing.
> 




Messages sorted by: Reverse Date, Date, Thread, Author