On Sat, 7 Sep 2019 at 22:19, Stephane Chazelas wrote: > > 2019-09-07 20:09:57 +0200, Sebastian Gniazdowski: > > The parsing would have to be changed to prevent the "=" in function names? > [...] > > No, I meant that you'd need the parser to handle that case of a > pseudo-command group (a {any shell code here} but with {| > instead of {)). > > So you can do: > > echo ${| > whatever $(...) > for i do > ... > done} > > Whether it would actually be difficult or not I can't comment, > I've not looked at the parser code. I think that it's already supported with the single exception that } would have to be quoted: % print ${| whatever $(...) for i do ... done;} zsh: no such function: \n whatever $(...)\n for i do\n ...\n done > Having an operator that *only* invokes a function to do an > expansion is less useful IMO. That just sound like a very > limited form of command substitution where you could have done a > more complete form by allowing any code instead of just one > function invocation without argument. Ok, I agree, the lambda-function reminiscent version is better. It also isn't much harder to implement – instead of the doshfunc() just bin_eval() would have to be called. I attach such patch. However, it has some problems: arr=( val1 val2 abc1 abc3 ) print ${arr[@]//(#b)(*)/${|REPLY\=test;}} Output:test test test test So the = has to be quoted. Also, not much more works. REPLY\=$MATCH nor REPLY\=\$MATCH are working. I wonder why, as it doesn't look that bad in general: whatever() { echo func ran; } echo ${| whatever $(...) for i in a b c; do REPLY\=1 done;} Output: func ran 1 -- Sebastian Gniazdowski News: https://twitter.com/ZdharmaI IRC: https://kiwiirc.com/client/chat.freenode.net:+6697/#zplugin Blog: http://zdharma.org