From: SZEDER Gábor Date: Tue, 18 Jun 2019 16:55:25 GMT Subject: Re: [PATCH v2 01/10] t: add helper to convert object IDs to paths Message-ID: <20190618165525.GN31952@szeder.dev> In-Reply-To: On Tue, Jun 18, 2019 at 06:15:46PM +0200, Johannes Schindelin wrote: > > Regardless of how it is implemented, I have another gripe with this > > helper: the way it must be used requires a process: $(test_out_to_path > > $foo) > > Indeed. > > > And looking through this patch series, I see a gazillion of *new* > > process substitutions $(test_something...) and $(basename $whatever). > > Can't we do something about it? > > I wish there was. Unix shell scripting has not evolved much in the past, > what, 3 decades? So I don't really see a way to "pass variables by > reference" to shell functions, short of calling `eval` (which buys > preciously little as it _also_ has to spawn a new process [*1*]). > Footnote *1*: Theoretically, it could be a *ton* faster by using threads > on Windows. But threads are pretty much an afterthought on Unix/Linux, so > no mainstream POSIX shell supports this. They all `fork()` to interpret an > `eval` as far as I can tell. 'eval' doesn't fork(). It can't possibly fork(), because if it did, then any variables set in the eval-ed code snippet couldn't be visible outside the 'eval'.