2006/1/5, Axel Liljencrantz <[EMAIL PROTECTED]>:
> By the way, forgot to say welcome to the fish mailing list. Hi!

Thanks. I hope I'm not stepping on to many toes when I'm coming in as
a newbie and challenges fish design decisions in my first couple of
posts ;-)

> On 1/4/06, Isak Savo <[EMAIL PROTECTED]> wrote:
> > What's the position on using && syntax for doing multiple commands
> > depending on the exit status of the previous. The current usage of
> > 'and'/'or' builtins is awkward at best, kind of reminds me of the old
> > calculators where you entered the operator first and then the numbers.
> >
> > It especially makes it hard to nest logic:
> >     or and make; make install; make clean
> > vs.
> >    make && make install || make clean
>
>  The position is this:
>
>  In retrospect, the RPN notation, i.e. putting the conditional _before_ the
> first operand instead of between them, was a mistake. It will be fixed.
> Possibly in the next version. But soon, at least.

Great to hear!

>  As to using && and || instead of and and or, I am strongly against it,
> since it means that they won't be regular builtins, but instead some kind of
> operators, and I strive for as much syntactic constency as possible. In
> other words, the new syntax will be:
>
>  make; and make install; or make clean

Sounds good. For me, it doesn't really matter if you're using 'and' or
'&&' for logical and, it was the RPN-notation that bugged me most :-)

>  I've been saying this'll be happening 'soon' for about a month, I belive,
> and I still haven't gotten around to it. If that is an acceptable definition
> of 'soon' can be debated.
>
>  Reasons why I feel and is better than &&:
>
>  * Smaller syntax with fewer special syntaxes
>  * Easier to learn if you're new to scripting, since you can find out about
> it through tab completion
>  * The syntax is more closely related to the 'if' syntax

Good points, although the "easier to learn" point is double sided.
Anyone with previous programming/scripting knowledge understands the
'and' operator to be, well, an operator and not a command. Having it
as a builtin makes it inconsistent with most other
scripting/programming languages (which may or may not be a good thing,
depending on your design goals)

I'm biased though, since I'm a big fan of writing series of commands
using && and || on the command line. In a shell script, I guess either
syntax works.

>  The disadvantages are:
>
>  * It's not Posix

This could be a major issue for new fish users coming from
"traditional" shells. Although I totally agree with you that the
POSIX/bash syntax isn't the best and that fish shouldn't try to be
100% POSIX compatible, this is one thing where they got it right.
IMHO.

>  * You have to add an extra ';' before the conditional operator.
>
>  I think all the pros and cons listed above are valid, but the pros, in my
> opinion, outweigh the cons.

Maybe they do, I'm not sure.

Isak


-------------------------------------------------------
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://ads.osdn.com/?ad_idv37&alloc_id865&op=click
_______________________________________________
Fish-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fish-users

Reply via email to