Hi, I would like to have your opinion about what you want ensureCreateFile to do. According to me ensureCreateFile should do the same thing as ensureCreateDirectory + create the file in the last directory given but in its implementation if the parents of this file doesn't exist we get an Exception. Is it wanted or an error? Valentin.
I would call error 2016-04-20 17:13 GMT+02:00 Valentin Ryckewaert < valentin.ryckewaert@gmail.com>:
Hi,
I would like to have your opinion about what you want ensureCreateFile to do. According to me ensureCreateFile should do the same thing as ensureCreateDirectory + create the file in the last directory given but in its implementation if the parents of this file doesn't exist we get an Exception.
Is it wanted or an error?
Valentin.
At least in unix creating files and folders are different operations (mkdir/touch, rm/rmdir). And even though it may seem convenient I would argue that it will create unintentional issues â if you have incorrect folder it will silently create errornous structure on the disk instead of throwing error. Imho overloading ensureCreateFile is bad. But there's nothing stopping you from extending AFR and adding an extra method: AbstractFileReference>>ensureCreateFileAndDirectory "Create if necessary a folder and file for the receiver." self parent ensureCreateDirectory. self ensureCreateFile Peter On Wed, Apr 20, 2016 at 6:16 PM, Denis Kudriashov <dionisiydk@gmail.com> wrote:
I would call error
2016-04-20 17:13 GMT+02:00 Valentin Ryckewaert < valentin.ryckewaert@gmail.com>:
Hi,
I would like to have your opinion about what you want ensureCreateFile to do. According to me ensureCreateFile should do the same thing as ensureCreateDirectory + create the file in the last directory given but in its implementation if the parents of this file doesn't exist we get an Exception.
Is it wanted or an error?
Valentin.
Yes but why ensureCreateFile then ? Why don't we juste create a message createFile as there is createFolder ? createFolder : create the folder createFile : create the file ensureCreateFolder : create the folder and its parents if necessary ensureCreateFile : create the file and its parents if necessary 2016-04-21 9:46 GMT+02:00 Peter Uhnák <i.uhnak@gmail.com>:
At least in unix creating files and folders are different operations (mkdir/touch, rm/rmdir).
And even though it may seem convenient I would argue that it will create unintentional issues â if you have incorrect folder it will silently create errornous structure on the disk instead of throwing error. Imho overloading ensureCreateFile is bad.
But there's nothing stopping you from extending AFR and adding an extra method:
AbstractFileReference>>ensureCreateFileAndDirectory "Create if necessary a folder and file for the receiver."
self parent ensureCreateDirectory. self ensureCreateFile
Peter
On Wed, Apr 20, 2016 at 6:16 PM, Denis Kudriashov <dionisiydk@gmail.com> wrote:
I would call error
2016-04-20 17:13 GMT+02:00 Valentin Ryckewaert < valentin.ryckewaert@gmail.com>:
Hi,
I would like to have your opinion about what you want ensureCreateFile to do. According to me ensureCreateFile should do the same thing as ensureCreateDirectory + create the file in the last directory given but in its implementation if the parents of this file doesn't exist we get an Exception.
Is it wanted or an error?
Valentin.
2016-04-21 9:55 GMT+02:00 Valentin Ryckewaert <valentin.ryckewaert@gmail.com
:
Yes but why ensureCreateFile then ? Why don't we juste create a message createFile as there is createFolder ? createFolder : create the folder createFile : create the file
ensureCreateFolder : create the folder and its parents if necessary ensureCreateFile : create the file and its parents if necessary
+1
because it's like this ensureCreateFolder : create the folder structure if necessary ensureCreateFile : create the file if necessary I really don't see any gain from changing existing behavior and introducing potential problems. If I ask for file to be created, I don't expect that the system will suddenly start creating folders, that's a unintentional side effect. If you need it for your convenience, then it's dead-easy to implement without breaking existing stuff. On Thu, Apr 21, 2016 at 10:35 AM, Denis Kudriashov <dionisiydk@gmail.com> wrote:
2016-04-21 9:55 GMT+02:00 Valentin Ryckewaert < valentin.ryckewaert@gmail.com>:
Yes but why ensureCreateFile then ? Why don't we juste create a message createFile as there is createFolder ? createFolder : create the folder createFile : create the file
ensureCreateFolder : create the folder and its parents if necessary ensureCreateFile : create the file and its parents if necessary
+1
For me ensureCreateFolder is made to be sure the folder is created, if you make '/home/a/b/c/d' with a b c d not existing it will create all of them. ensureCreateFile should do the same thing no ? 2016-04-21 13:19 GMT+02:00 Peter Uhnák <i.uhnak@gmail.com>:
because it's like this
ensureCreateFolder : create the folder structure if necessary ensureCreateFile : create the file if necessary
I really don't see any gain from changing existing behavior and introducing potential problems. If I ask for file to be created, I don't expect that the system will suddenly start creating folders, that's a unintentional side effect. If you need it for your convenience, then it's dead-easy to implement without breaking existing stuff.
On Thu, Apr 21, 2016 at 10:35 AM, Denis Kudriashov <dionisiydk@gmail.com> wrote:
2016-04-21 9:55 GMT+02:00 Valentin Ryckewaert < valentin.ryckewaert@gmail.com>:
Yes but why ensureCreateFile then ? Why don't we juste create a message createFile as there is createFolder ? createFolder : create the folder createFile : create the file
ensureCreateFolder : create the folder and its parents if necessary ensureCreateFile : create the file and its parents if necessary
+1
participants (3)
-
Denis Kudriashov -
Peter Uhnák -
Valentin Ryckewaert