bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Documentation issue


From: Eli Barzilay
Subject: Re: Documentation issue
Date: Mon, 30 Oct 2017 00:05:51 -0400

On Sun, Oct 29, 2017 at 10:44 PM, Clark Wang <dearvoid@gmail.com> wrote:
>
> Different people have different expectations which they believe are
> all important.

Yes, and I have already went over this several times: this is an issue
that does confuse people, both ones that I have spoken to and in
tutorial/example/etc pages that come up on top when searching.


> It's not possible to cover so many tricky things in the manual.

It definitely is; it's a tradeoff between things that are worth
mentioning and the size becoming big enough that people won't bother
reading it, hence I tried to suggest a very small change.


> To me the most important thing is to describe the syntax correctly.

This is a non-point.  I obviously don't think that some explanation
should be added *instead* of existing descriptions, or instead of the
current completeness level.


> When you understand the syntax "unset arr[i]" would never surprise
> you.

Again, `unset` has different expectations, because it seems like it
would be a special construct -- since it's dealing with *lvalues*.  Like
I said, the other place where array reference lvalues appear in bash,
assignments, do treat these "lvalue expressions" differently, and even
though it is for a different reason, it makes it easier to get confused
and assume that `unset` is special too.  To summarize:

* In assignments like a[0]=foo, the a[0] part is treated in a special
  way because otherwise it will not be an assignment.  Specifically,
  quoting the whole "a[0]" is not needed, and adding it will break in an
  obvious way.

* In plain variable referendces, $a[0] is wrong anyway, and in ${a[0]}
  there is no need to quote the a[0] since no path expansion is done
  there anyway, and, again, it will break in an obvious way.

* The last kind of reference is unset, and after the above two it is
  reasonable to assume that it *will* be special and will not require
  quoting as well.  That's why I think that a warning that it is not
  special is warranted.

Yet another way to phrase the above: I don't think that you can mess up
these assignments or references with a file like "a0"; but you can do so
for `unset`.

-- 
                   ((x=>x(x))(x=>x(x)))                  Eli Barzilay:
                   http://barzilay.org/                  Maze is Life!



reply via email to

[Prev in Thread] Current Thread [Next in Thread]