Le 04/05/2010 14:40, Eric Blake a écrit : > Except that in computing tab completion, side effects are _all_ that > you want - basically, Freddie's problem is how to populate the > global completion variables from within helper functions.
Of course you want a side-effect in the caller, and my example achieves that. I only moved the side-effect from the callee to the caller, from where it is spurious to where it is wanted. > Except that it forks a subshell and consumes trailing newlines, and > the whole point of this exercise is to avoid forks and spurious > corruption of trailing newlines. I fail to see the link between completion and newlines but that's probably just because I am not interested enough. I will try to find an alternative to eval $( ) Are you are worried about the *cost* of the subshell? How can interactive completion be performance-sensitive? In shell there is really not much left you can do if you forbid yourself from forking. The whole philosophy is based on small cooperating processes isn't it? http://www.faqs.org/docs/artu/ch01s06.html I guess this is why it still stands today after decades while kids play with shared memory and race conditions.