Sometime ago in a code-review (C++) I suggested to change the input argument from Path
type to Optional<Path>
, where the function has specific logic for unset path. It looks for me intuitively better, but the author appealed that Path::empty()
(empty path) method should semantically mean the same as unset Optional
.
My sole rational argument is that empty path may also be interpreted as the current working directory. But then I also thought that .
may be used as CWD as well.
What is a good default semantic for a cross-platform API path emptiness? E.g. .
may be not so common outside *nix OSes, or there are already some common semantics in any popular programming language.