Hi Hannes, On Tue, 18 Jun 2019, Johannes Sixt wrote: > Am 18.06.19 um 03:29 schrieb brian m. carlson: > > On 2019-06-17 at 19:05:03, Johannes Schindelin wrote: > >> I guess it does not *really* matter all that much, but this does spawn a > >> new process (and I think it actually spawns 4 on Windows, for reasons, and > >> spawning processes is super expensive on Windows). > >> > >> We might actually want to think about using something like this instead > >> (which admittedly looks a bit like gobbledygook to the uninitiated, but it > >> definitely avoids any spawned process): > >> > >> test_oid_to_path () { > >> echo "${1%${1#??}}/${1#??}" > >> } > > > > I'm fine making that change. The original design was because we had > > other code that used that technique and I didn't see an obviously better > > solution. Now you've provided one and a good justification. > > 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*]). Of course, if we would slowly get away from depending so much on shell scripting, then we would reap quite a few other benefits, too, not only speed, but also much easier debugging, code coverage, etc. Ciao, Dscho 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.