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

Re: syntactic trivia

Bart Schaefer wrote on Sat, 02 Jan 2021 11:13 -0800:
> Assuming not, a more reasonable approach would be to allow line
> continuation to appear AFTER a comment, e.g.,
>   [[ stuff ]] && do-this  # Why did I do this? \
>     || do-that
> It's unlikely that any significant amount of existing code has
> comments ending with a backslash,

I'd actually expect this to be somewhat common in codebases that
restrict themselves to some fixed column width.  For example,
Subversion (which is written in 80-column C) has these:

tools/examples/svnput.c:39: *  cc svnput.c -o svnput \
tools/examples/svnput.c:40: *  -I/usr/local/include/subversion-1 -I/usr/local/apache2/include \
tools/examples/svnput.c:41: *  -L/usr/local/apache2/lib -L/usr/local/lib \
subversion/include/svn_repos.h:2467: * @defgroup svn_repos_hook_wrappers Hook-sensitive wrappers for libsvn_fs \
subversion/include/svn_repos.h:2949: * @defgroup svn_repos_inspection Data structures and editor things for \
subversion/include/svn_client.h:2357: * @defgroup Status Report interesting information about paths in the \
subversion/libsvn_client/merge.c:12314: *         /         \
subversion/libsvn_client/merge.c:12315: *   -----o     prev. \
subversion/libsvn_client/merge.c:12316: *     YCA \    merges \

The first of these examples is probably the most typical one.  (The
second one is Doxygen directives, which may or may not actually need
explicit line continuation.  The third one is an ASCII art diagram.)

> but such a change would probably have to be controlled by an option
> nonetheless.

I can't say I'm a fan of syntax-changing options, and in this case
there's an easy workaround:

if foo # ...
then bar # ...
else baz # ...



P.S.  Ray, please use more specific subject lines.  If you wouldn't
have picked a book called "syntactic trivia" from the shelf at a book
shop, then it's not a good subject line.

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