Re: Tip 323 and file join



keithv wrote:
I noticed TIP #323: Do Nothing Gracefully explicitly excludes
file join. I'm okay that there is some good reason for doing
so.

TIP 323 was limited to those commands where it was blindingly
obvious what the meaning of zero arguments ought to be. The
question for [file join] is "what is the file pathname with
zero components?" and at least for me that takes more than a
second's thought, so it was left out to be considered separately.

My initial guess is that the path with zero components is the
empty string, but that just raises the next uncomfortable question,
"what does the empty string, interpreted as a file pathname, signify?"
See Tcl Bug 2001389.

But I was wondering if the simple trick of appending "" to
the command is safe? It seems to yield the same results.

For example:
file join {*}{} ;# fails
file join {*}{} "" ;# success
file join {*}{a b c} ;# okay
file join {*}{a b c} "" ;# same as above

The answer can plausibly depend on what VFS drivers are active and what
they are configured to do. I can't give you a definitive judgment of
safety without a pretty deep source dive.

--
| Don Porter Mathematical and Computational Sciences Division |
| donald.porter@xxxxxxxx Information Technology Laboratory |
| http://math.nist.gov/~DPorter/ NIST |
|______________________________________________________________________|
.