Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [PATCH 2/3] jp: Use `(nil)` for empty identifier strings



Joey Pabalinas wrote on Sun, 14 Jan 2018 05:23 -1000:
> +++ b/Src/params.c
> @@ -3004,6 +3004,8 @@ assignsparam(char *s, char *val, int flags)
>      int sstart, created = 0;
>  
>      if (!isident(s)) {
> +	if (!strcmp(s, ""))
> +	    s = "(nil)";
>  	zerr("not an identifier: %s", s);

How about inventing an %ls expando that emits the argument quoted, so
zerr("%ls", foo) would print ${(qq)foo} or ${(q-)foo}.  That seems easier
than updating all callsites (not just these three).

(%ls/%s by analogy with %ld/%d.)

Cheers,

Daniel



Messages sorted by: Reverse Date, Date, Thread, Author