Open hexagonrecursion opened 2 years ago
Yes I think this is a fair point -- I know people try to avoid \
because of this issue.
Oil already warns for something similar:
$ oil -c 'echo \z'
echo \z
^~
[ -c flag ]:1: Invalid char escape (parse_backslash)
So what I think we should do is disallow trailing \
on any word. I think that will be pretty easy to implement. You can always use trailing ' '
which is clearer (or you can use OSH).
Thanks for the feedback!
Sometimes we use line continuation:
VVV
Sometimes we accidentally leave a trailing space:
VVV
In a more complex example this can be difficult to troubleshoot because the space is invisible.
I think a better behavior for a programming language is to treat
<backslash><whitespace>*<LF>
as line continuation. It puzzles me why so many languages copy the misfeature of<backslash><LF>
. I understand that osh probably has to copy bash, but does oil?Here are some possible ways of improving the situation:
<backslash><whitespace>*<LF>
as line continuation.<backslash><whitespace>*<LF>
into a syntax error<backslash><whitespace>*<LF>