[phobos] next release (meaning of path)

spir denis.spir at gmail.com
Mon Jan 3 18:55:03 PST 2011


On Mon, 3 Jan 2011 14:42:01 -0800
Jesse Phillips <jesse.k.phillips at gmail.com> wrote:

> I do not know of a good reason for having a Path type. However I do
> believe much can be added to help with manipulated paths. Here are
> some issues I've had.
> 
> * Converting to the proper sep
> * getBaseName(getName(file)) will give just the filename and no path
> when there is no extension, switching the calls gives you nothing.
> * A quoted path is sometimes valid, and some times not. Namely making
> system calls needs the quotes or escaped spaces, while std.file
> expects none of that.
> * It should be easy to convert one OS path style to another. (Ignoring
> drive letter)


All of these features, together with ones already present in std.path, typically are what a type is meant for, I guess. Indeed, you can also have a bunch of free functions implicitely taking a string-meant-to-be-a-path as first argument; but functionally _and_ conceptually, it's the same thing. Or do I misinterpret?
Then if i'm right, the debate falls down to a question of programming style preference, or what? One could argue that no notion at all requires a type (an explicite type). But code clarity is also a feature (that some dose of OO style often helps providing).


Denis
-- -- -- -- -- -- --
vit esse estrany ☣

spir.wikidot.com



More information about the phobos mailing list