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

Re: PATCH: pws-19: minor syntactic innovation



On May 23,  5:15pm, Peter Stephenson wrote:
} Subject: PATCH: pws-19: minor syntactic innovation
}
} Just thought of a trivial way to take a lot of grief out of parameter
} substitution.  This patch makes the following valid:
} 
}   ${${${${(f)"$(typeset)"}:#*local *\=*}%%\=*}##* }

Hooray, hooray, hooray.  About six times a year I try that kind of syntax
(having forgotten it doesn't work), grumble to myself, and do it some other
way.  Thank you.  I always assumed there was some incredibly hairy parsing
thing that had to be done to consume the quoted string at that point.

} replacing the equivalent but grotesquer
} 
}   "${(@)${(@)${(@)${(@f)$(typeset)}:#*local *\=*}%%\=*}##* }"

Perfect.

I'm tempted to try something similar in 3.0.6 ... except because of this:

} Since you got nothing when you did that before, I don't see how it can
} break anything.  The key point is that quotation of a substitution is
} already tested for by looking at whether it begins with a quoted $, not by
} whether the parent substitution is quoted.

If I put this patch of yours into 3.0.6, will it behave differently than
it does in 3.1.5 (e.g., because of the mult_isarr change)?  If so, I think
I'd rather not introduce differing new behaviors in the two branches.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com



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