Welcome back, John. Long time since your last post!

On 2/18/06, John Brock <[EMAIL PROTECTED]> wrote:
> John Brock
> [EMAIL PROTECTED]
>
> On Fri, Feb 17, 2006 at 07:05:19PM -0500, Philip Ganchev wrote:
> > ---------- Forwarded message ----------
> > From: Axel Liljencrantz <[EMAIL PROTECTED]>
> > Date: Feb 17, 2006 11:30 AM
> >
> > Hmmm, did you intend for this mail to be on-list? If so, feel free to
> > forward this reply to the list as well...
>
> > On 2/9/06, Philip Ganchev <[EMAIL PROTECTED]> wrote:
> > > Allowing "foo |; bar" is bad because it complicates the rule for
> > > ending statements: a statement ends at a newline or semicolon EXCEPT
> > > if the preceding token is a pipe.
> > >
> > > A better option is to have an escape character (backslash), as
> > > Netocrat suggested earlier:
> > >
> > > for h in (cat /etc/dupload.conf $HOME/.dupload.conf ^/dev/null \
> > >         | awk -F "=" '/('\''fqdn'\''| *fqdn *=)/ {print $2}' \
> > >         | cut -d"'" -f2 \
> > >         | cut -d'"' -f2)
> > >     set hosts $hosts $h
> > > end
> > >
> > > In this way, semicolon (;) and newline mean the same thing, and
> > > strange expressions like "foo |; bar" are avoided.  Axel originally
> > > objected (and I replied):
>
> > I dislike this because it is impossible to tell if a newline is
> > escaped or if one is escaping a space character. Though I've thought
> > about this for a bit and have come to the conclusion that this is an
> > editor issue. An editor could, if it wanted to, differentiatte between
> > the two, for example by highlighting the backslashed newline using a
> > different background color.
> >
> > I guess an otherwise rather sane syntax should not be punished because
> > editors are stupid.
>
> Personally I like "\" as a line continuation character.  It's syntax
> that a lot of people are familiar and comfortable with.  So why
> not just make it the rule that fish discards all whitespace at the
> end of a line (unless you are inside a quote or something)?  Then
> "\" as the last non-whitespace character in a line always means
> line continuation, and you never have to worry that it might instead
> be escaping a space character.  (Does leading whitespace ever matter
> in fish?  Then why should trailing whitespace?)

That is an interesting idea. The benefits you outline above are
desirable. The result is however somewhat unintuitive in other cases.
Say that you want to replace all tabs in the output of grep with
spaces. An easy way to do this would be:

grep WHATEVER | tr \t \

Observe that the above line ends with an escaped space character, and
does it on purpose. If your suggestion where followed, the above would
result in tr beeing sent a single argument, not the intended two. To
get the intended behaviour you would have to replace backslash+space
with a quoted space (' ').

But allowing backslash+whitespace+newline to mean the same thing as
backslash+newline has, as you pointed out, some obvious benefits as
well. Very interesting suggestion. Opinions are welcome.


--
Axel


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid3432&bid#0486&dat1642
_______________________________________________
Fish-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fish-users

Reply via email to