digitalmars.D - How my little brother try D
- Daniel Kozak (16/16) Apr 02 2016 Few days ago, my little brother (13 years old) ask me about
- Lass Safin (6/15) Apr 02 2016 You're right in how it isn't obvious for non-techy people. I do
- jmh530 (12/17) Apr 02 2016 If I were looking at the documentation with fresh eyes, I would
- cym13 (6/24) Apr 03 2016 To be fair I've always thought that mv is a bad name because
- Daniel Murphy (2/6) Apr 03 2016 Except that's not true! Renaming doesn't (typically) work across device...
- cym13 (2/13) Apr 03 2016 Right, thanks for pointing that out.
- Walter Bright (2/4) Apr 02 2016 https://issues.dlang.org/show_bug.cgi?id=15865
- Jesse Phillips (5/8) Apr 04 2016 Wait until he needs to rename a file in C#, then D suddenly
- Jesse Phillips (10/18) Apr 04 2016 Oh this was the other thing I was looking for:
- =?UTF-8?Q?Tobias=20M=C3=BCller?= (3/8) Apr 05 2016 That's wrong AFAIK.
Few days ago, my little brother (13 years old) ask me about writing some small utility. He needed find all files with selected extensions and move them to some another location. He you will see which one suited you better. asked why he answered me that in D there is no std.file.move method (I know there is a rename method but it is not obvious) so he has to use std.file.copy and std.file.remove. And when he try it with just std.file.copy (so he does not use remove yet) he end up with remove all files anyway. When std.file.copy is used with same src and dst (this was caused by anoher mistake) it removes original file and does not make the new one. Maybe it would be nice to have alias for rename method or have better doc for rename. And probably we should fixed copy method to not remove files with same src and dst path :)
Apr 02 2016
On Saturday, 2 April 2016 at 21:29:27 UTC, Daniel Kozak wrote:Few days ago, my little brother (13 years old) ask me about writing some small utility. He needed find all files with selected extensions and move them to some another location. He and you will see which one suited you better. [...] Maybe it would be nice to have alias for rename method or have better doc for rename. And probably we should fixed copy method to not remove files with same src and dst path :)You're right in how it isn't obvious for non-techy people. I do suppose it would be doable without breaking any old code (unless for some arcane reason the code depends on static assert(!__traits(allMember, std.file).canFind("move"))...), so why not create a PR with "alias move = rename" inside?
Apr 02 2016
On Saturday, 2 April 2016 at 22:54:09 UTC, Lass Safin wrote:You're right in how it isn't obvious for non-techy people. I do suppose it would be doable without breaking any old code (unless for some arcane reason the code depends on static assert(!__traits(allMember, std.file).canFind("move"))...), so why not create a PR with "alias move = rename" inside?If I were looking at the documentation with fresh eyes, I would be just as confused as the OP's brother. It's not about being non-techy. Someone had an issue with the documentation and commenting on their inexperience won't improve the documentation. The documentation has no examples. It doesn't mention file paths at all. I.e., easy to get confused. Moreover, posix systems have mv, which can move and rename. mv is a crappy name, but at least if the function would have the same semantics as mv, they could have named it move instead of rename. Seems like a silly breaking change at this point, so they should just improve the docs.
Apr 02 2016
On Sunday, 3 April 2016 at 03:28:48 UTC, jmh530 wrote:On Saturday, 2 April 2016 at 22:54:09 UTC, Lass Safin wrote:To be fair I've always thought that mv is a bad name because moving really is just renaming, there are no two separate operations. That said I too would have searched for "move" first exactly because as misleading as the name can be it corresponds to what the user wants to do.You're right in how it isn't obvious for non-techy people. I do suppose it would be doable without breaking any old code (unless for some arcane reason the code depends on static assert(!__traits(allMember, std.file).canFind("move"))...), so why not create a PR with "alias move = rename" inside?If I were looking at the documentation with fresh eyes, I would be just as confused as the OP's brother. It's not about being non-techy. Someone had an issue with the documentation and commenting on their inexperience won't improve the documentation. The documentation has no examples. It doesn't mention file paths at all. I.e., easy to get confused. Moreover, posix systems have mv, which can move and rename. mv is a crappy name, but at least if the function would have the same semantics as mv, they could have named it move instead of rename. Seems like a silly breaking change at this point, so they should just improve the docs.
Apr 03 2016
On 3/04/2016 9:35 PM, cym13 wrote:To be fair I've always thought that mv is a bad name because moving really is just renaming, there are no two separate operations. That said I too would have searched for "move" first exactly because as misleading as the name can be it corresponds to what the user wants to do.Except that's not true! Renaming doesn't (typically) work across devices.
Apr 03 2016
On Sunday, 3 April 2016 at 13:24:20 UTC, Daniel Murphy wrote:On 3/04/2016 9:35 PM, cym13 wrote:Right, thanks for pointing that out.To be fair I've always thought that mv is a bad name because moving really is just renaming, there are no two separate operations. That said I too would have searched for "move" first exactly because as misleading as the name can be it corresponds to what the user wants to do.Except that's not true! Renaming doesn't (typically) work across devices.
Apr 03 2016
On 4/2/2016 2:29 PM, Daniel Kozak wrote:And probably we should fixed copy method to not remove files with same src and dst path :)https://issues.dlang.org/show_bug.cgi?id=15865
Apr 02 2016
On Saturday, 2 April 2016 at 21:29:27 UTC, Daniel Kozak wrote:I asked why he answered me that in D there is no std.file.move method (I know there is a rename method but it is not obvious)becomes easier. Seriously though I agree, rename doesn't work across drives and Linux uses move for renaming (Windows uses rename for moving).
Apr 04 2016
On Monday, 4 April 2016 at 20:53:43 UTC, Jesse Phillips wrote:On Saturday, 2 April 2016 at 21:29:27 UTC, Daniel Kozak wrote:Oh this was the other thing I was looking for: http://stackoverflow.com/a/23231073/34435 http://stackoverflow.com/a/20930431/34435 It also throws an exception if the file already exists instead of overwriting. And if you're in Windows you still need to worry about file locking. But D does worse there, and still has annoyances I don't recall.I asked why he answered me that in D there is no std.file.move method (I know there is a rename method but it is not obvious)becomes easier. Seriously though I agree, rename doesn't work across drives and Linux uses move for renaming (Windows uses rename for moving).
Apr 04 2016
Jesse Phillips <Jesse.K.Phillips+D gmail.com> wrote:Oh this was the other thing I was looking for: http://stackoverflow.com/a/23231073/34435That's wrong AFAIK. Tobi
Apr 05 2016