On Thursday, 16 February 2017 at 17:06:30 UTC, Jonathan M Davis wrote:

Well, there's zero difference between renaming the file or directory and moving it. It's simply a difference in name. rename actually comes from POSIX, where rename is used in C code, and mv is used in the shell. So, I guess that you can blame POSIX. But there really isn't any reason to have a mv or move function in addition to rename.

`mv` or `move` would be more intuitive. I actually looked for names similar to the operations available in the shell (cp/copy, mv/move). It took me a few minutes to realize I had to use `rename` (which is poorly documented). But it is counter-intuitive. When you use a GUI, `rename` doesn't change the location. `rename` is a bit "techy", you have to go "wait a minute, when you think about it, rename should do the same". But that's not good enough for a library function. One of D's slogans is `simple things should be simple`, so moving a file should be `move(dir, toDir)`. Seriously, you don't want to spend much time on stuff like that.

If you want mv instead, just alias rename to mv.

However, I would point out that rename has the problem (at least on *nix - not sure about Windows) that it can't move across filesystem boundaries. I think that at some point, an alternative which did work across filesystem boundaries was proposed, and that may have been called move. It's not currently in Phobos though.

- Jonathan M Davis

That is actually a bit of a problem. First, I might want to store backup files on a different device. Second, loads of applications need this nowadays to interact with MP3 players, ebook readers etc.

Reply via email to