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

Re: Block comments ala Ray



On Thu, Feb 11, 2021 at 10:42 PM Roman Perepelitsa
<roman.perepelitsa@xxxxxxxxx> wrote:
>
> Do these benefits justify adding new syntax that's unique to zsh?

It's not as though zsh doesn't have lots of other unique syntax.

> On Fri, Feb 12, 2021 at 7:17 AM Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> >
> > 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?
>
> If this were valid syntax, I would expect it to work like in C. In
> other words, I would expect there to be two commands:
>
>   print this
>   is the rest of the command

It turns out not to be very difficult to make !# ... #! (or <# ... #>)
work that way, but ... that's not really how it works in C.  You
wouldn't expect

int /* watch me explain
why this next variable
is not a float */ thing;

to behave like "int; thing;".  My original point is that the shell
doesn't have the syntactic clues to tell you that "print this" (in the
example) is not already a complete command, the way you can tell in C
by the missing semicolon that something must eventually be coming
after "int".




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