I'm assuming the file.open() function will close any open file. When does your 
suggestion close the file?

bearophile Wrote:

> Regarding this:
> 
> auto f = File("fileio.txt", "w");
> ...
> f.open("fileio.txt", "r");
> 
> It is correct, because it first calls detach(), but what is the purpose of 
> the open() method? At first sight this is the main difference between the D 
> and Python file API. Isn't it more clear and simpler to write just:
> 
> auto f = File("fileio.txt", "w");
> ...
> f = File("fileio.txt", "r");
> 
> I don't see the need of the open() method, it looks like noise in the File 
> API. Do you know its purpose?
> 
> Bye,
> bearophile

Reply via email to