Feels like I'm repeating myself a bit here, but welcome back, James.
Long time since your last post! :-)

On 2/20/06, James Antill <[EMAIL PROTECTED]> wrote:
> "Axel Liljencrantz" <[EMAIL PROTECTED]> writes:
>
> > 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:
> >> > 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.
>
>  A much bigger problem IMO is that fish doesn't parse \\, and to add
> compatibility you'd basically need a full \ parser (you'd at least
> need to understand \ EOL and \\, at which point you might as well add
> \n \t \b \r \0xx \xxx etc.).

?

Fish _does_ have a \ parser. \n, \t, \\  and friends all work, as do
\$, \{, \% \(, and other characters used for argument expansion. Fish
even supports \xXX, \oOOO, \uXXXX, etc for arbitrary symbols, e.g.
'echo \u2026' writes out an unicode ellipsis character to stdout.

Actually, though, one of the above _is_ missing, namely \0. Fish
internally uses null-terminated strings, it would take a bit of work
to handle \0 correctly, though I suppose that this should be done.

>
>  Also, personally, I don't see:
>
> echo a |; cat
>
> ...as anymore weird than:
>
> echo a ;;; ;;; echo  b

The way I see it, (and the way fish currently sees it,
implementation-wise) is that a newline is exactly equivalent to a ';'.
The tokenizer (fish uses an internally implemented tokenizer since
there is (was?) no flex-lookalike with support for wchar_t) returns
exactly the same symbol for both, TOK_END, when either of these is
encountered in an unquoted context. I think that this is a very sane,
simple and intuitive way to look at things.

The above code example is, as fish sees it, equivalent to

echo a




echo b

Which is a prefectly resaonable chunk of code. So while youir example
seems a little bit weird, I see no reasone why it should not be
syntactically allowed, I see no way it coult be interpreted to mean
anything else, and I see lots of languages where this is perfectly
legal. Keep in mind that ';;' is a set of two perfectly legal C
statements as well.

>
> ...which is already valid.
>
> >> Personally I like "\" as a line continuation character.  It's syntax
> >> that a lot of people are familiar and comfortable with.
>
>  Because people generally, IMO, don't like half of an idiom. Having
> \ EOL behaviour is an overall part of \ processing that people
> understand ... having just one bit is going to be very confusing.

Like I said before, the other pieces are already there.

>
> >>  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)?
>
>  Which would make it's behaviour different from anything else that
> does \ processing.
>
> > 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 \
>
>  Even better is:
>
> foo | tr \t\  \\\

I'm missing something here. How is this better and what would this do?

>
> --
> James Antill -- [EMAIL PROTECTED]
> http://www.and.org/and-httpd
>
>


--
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