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

Re: question of (C) and (s::)

On Sep 30,  3:35pm, Han Pingtian wrote:
} % x=foosbar;print ${(Cs:s:)x}
} Foo Bar
} But in rules of parameter expansion flags, "case mofification" is the
} 11th, "forced splitting" is the 16th, so I think we should get "Foo bar"
} as the result here. Right? Or I'm missing something here? 

Hmm, I think "The Rules" have one thing out of place.

(f) and (s) and even the shell word splitting (both SH_WORD_SPLIT and
the '=' flag) are applied immediately after "forced joining".  The only
thing that's delayed until just before "uniqueness" is the (z) flag.

Either this changed at some point (entirely possible as several tweaks
have been made over the years to make SH_WORD_SPLIT behave more like
the original /bin/sh) or the code in subst.c was misread when the rules
were composed (the comment in subst.c explaining that the (z) section
doesn't have anything to do with (s) post-dates the rules).

So really 16 and 17 should be combined as 11 except that mention of (z)
should be removed from the new 11; the old 11 through 15 should be
renumbered 12 through 16; and 17 should be the (z) flag by itself.

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