Eric Blake <ebl...@redhat.com> writes: > On 02/27/2017 07:36 AM, Markus Armbruster wrote: > >> >>> Maybe just 'foo.array[]' (without any =) for an empty >>> array or something like that. >> >> Yes, that should do. Likewise foo.object{} for empty object. >> >> {} doesn't even need quoting. [] may. > > [contents] needs quoting, but [] does NOT need shell quoting (no shells > treat it as a glob), for the same reason that 'if [ -e "$file" ];' needs > no quoting around the [ or ] (the shell only requires quotes for [ if > the rest of the shell word can look like a valid glob, but globs require > intermediate content before the ]).
Bash shell options failglob and nullglob can still mess it up. >>> Before we introduce anything like this, do we actually need it? >> >> I don't know whether anything needs optional, present and empty. But >> even if the answer is "no" today, it need not remain "no". >> >> Anyone running into a case of "yes", will have to fall back to the JSON >> form of -blockdev. Strengthens my belief that providing JSON there is a >> good idea. >> >> The insufficient generality of dotted keys bugs me a bit. Not sure >> whether it justifies more syntax now. But we should document it. > > I agree that documenting it as a shortcoming of dotted form and pointing > to JSON form is okay. I also like that we are leaving the door open for > future expansion, if needed, and think that is better than inventing the > syntax now, especially for what we are trying to get into 2.9. Okay, I'll work on improving the documentation.