Re: Reintroducing fish, the friendly interactive shell
- From: "liljencrantz@xxxxxxxxx" <liljencrantz@xxxxxxxxx>
- Date: 7 Mar 2006 06:18:17 -0800
Stephane CHAZELAS skrev:
2006-03-6, 20:16(-08), liljencrantz@xxxxxxxxx:
[...]
Than you for your kind words. I'd say that many of the extensions
provided over the years have been implemented in rather inconsistent
ways. If functions, indirect variable expansion, arrays, local
variables and other new features had been better integrated into the
shell, the language would, in my opinion, have been in a much better
condition today.
I couldn't agree more.
Glad to hear we agree here. So, aside from the 'FOO=BAR echo
$FOO'-question, where we seem to see things differently, what are your
feelings on e.g. the fish array syntax?
[...]
[...]This is completely untrue. Although the explanation is beyond
the scope of the discussion (and our patience...), the grouping
keyword ("}") is commensurate with the other terminating
keywords "esac", "done", and "fi", and as such require being on
their own line or after another keyword.
If I understand you correctly, your point is that '}' should be viewed
as a command-like keyword, like 'esac' and 'fi'. And if you do so, it
will indeed seem more intuitive. But that is beside the point for me,
since one would not expect '}' to behave that way because:
* The syntax is clearly borrowed/inspired by from C-like languages
where } does not behave like a function or reserved word.
That could be a backward portability issue.
echo }
outputs "}" (it's not the case in zsh except in sh/ksh modes).
As you mentioned in another post, zsh is much more clever in it's
parsing of ';' and '}'. It may be that there are some awkward edge
cases where there is a clash between braces used to denote blocks and
braces used fo brace expansion, but overall the zsh syntax makes _much_
more sense to me. That said, there is of course still the issue of
using all these keywords for denoting end-of-block:
fi, esac, done, }, ;;
When testing around in zsh, the only thing that I felt should be
allowed which wasn't was the use of multiple ';' without any whitespace
between them. It seems that ';;' is interpreted as the case-end
keyword, and as such will lead to a parse error. That means that one
can legally write an empty command like this:
;
But one can't write two empty commands on a single line like this:
;;
which is of course a very minor detail all things considered. I mention
this mostly since I think that it makes a lot of sense from a language
point of view to minimize the difference between a ';' and a newline.
It is legal to have any number of newlines with no whitespace, so from
that perspective it makes sense to do the same with ';'. This is an
exact parallel to how spaces, tabs and newlines are exactly equivalent
outside of string literals in C. In fish ';' and newlines are
syntactically equivalent in none-quoted contexts, so you can write
';;;;;;;;;' and fish will gladly do nothing at all.
--
Stéphane
--
Axel
.
- Follow-Ups:
- Re: Reintroducing fish, the friendly interactive shell
- From: Stephane Chazelas
- Re: Reintroducing fish, the friendly interactive shell
- References:
- Reintroducing fish, the friendly interactive shell
- From: liljencrantz@xxxxxxxxx
- Re: Reintroducing fish, the friendly interactive shell
- From: bsh
- Re: Reintroducing fish, the friendly interactive shell
- From: liljencrantz@xxxxxxxxx
- Re: Reintroducing fish, the friendly interactive shell
- From: Stephane CHAZELAS
- Reintroducing fish, the friendly interactive shell
- Prev by Date: Re: uniq
- Next by Date: Re: split the file
- Previous by thread: Re: Reintroducing fish, the friendly interactive shell
- Next by thread: Re: Reintroducing fish, the friendly interactive shell
- Index(es):
Relevant Pages
|