Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATCH and more remarks on parameter expansion docs
On Tue, Jan 01, 2013 at 09:15:01PM -0800, Bart Schaefer wrote:
> On Dec 27, 3:08pm, Han Pingtian wrote:
> } Subject: Re: splitting in assignment forms of expansion
> }
> } I think we should say something like this about this feature in the man
> } page:
> }
> } Note during assignments with the A flag, that splitting is applied
> } to word in the assignment forms of spec before the assignment to
> } name is performed. This will affects the result.
>
> I added something similar in the patch.
Thanks your nice patch. But I'm still wondering why not change the
statements after "${=spec}" in man page. Or I'm misunderstanding the
original statements which has been stating this "splitting before
assignment" behavior is only related to "(A)" flag?
>
>
> The (t) flag is an oddball. If combined with (P) [rule 4], it takes
> effect after that name replacement. However, if *not* combined with
> (P), then it takes effect *before* subscripting [rule 3]. Thus:
>
> % x=path
> % print ${(t)x}
> scalar
> % print ${x[2,4]}
> ath
> % print ${(t)x[2,4]}
> cal
> % print ${(tP)x}
> array-unique-special
>
> I might have expected ${(t)x[2,4]} to print the type of the variable
> named "ath", but that isn't what happens. So I haven't attempted to
> work it into the rules, but it's a perfect example of how parameter
> expansion syntax lacks well-defined precedence.
Yep, it looks like there are quite some special cases.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author